Skip to content

admin user is not created when using unattended-setup #1537

@SachinMaharana

Description

@SachinMaharana

I am using ansible to install warpgate in a vm. even though the playbook runs just fine, but i can't login with the admin/password i setup.

warpgate recover-access admin
00:47:53  INFO Using config: "/etc/warpgate.yaml"
00:47:53  WARN Looks like your `external_host` config option contains a port - it will be ignored.
00:47:53  WARN Set the external port via the `http.external_port`, `ssh.external_port` or `mysql.external_port` options.
00:47:53 ERROR Fatal error error=User not found

Here is my barebones ansible playbook.

- name: base
  hosts: all
  vars:
    ansible_become: yes
    warpgate_version: "0.17.0"
    warpgate_admin_password: "ChangeMe123!"
  tasks:
  - name: Detect system architecture
    set_fact:
      warpgate_arch: "{{ 'x86_64' if ansible_architecture == 'x86_64' else 'arm64' if ansible_architecture == 'aarch64' else ansible_architecture }}"
      warpgate_os: "{{ 'linux' if ansible_system == 'Linux' else ansible_system.lower() }}"

  - name: Download Warpgate binary to /usr/local/bin
    get_url:
      url: "https://github.com/warp-tech/warpgate/releases/download/v{{ warpgate_version }}/warpgate-v{{ warpgate_version }}-{{ warpgate_arch }}-{{ warpgate_os }}"
      dest: "/usr/local/bin/warpgate"
      mode: '0755'
      owner: root
      group: root
      force: true
    register: warpgate_download
    retries: 3
    delay: 5
    until: warpgate_download is succeeded


  - name: Create Warpgate data directory
    file:
      path: /var/lib/warpgate
      state: directory
      owner: root
      group: root
      mode: '0750'


  - name: Check if Warpgate config exists
    stat:
      path: /etc/warpgate.yaml
    register: warpgate_config

  - name: Run Warpgate unattended setup
    command:
      cmd: >
        /usr/local/bin/warpgate unattended-setup
        --data-path /var/lib/warpgate
        --http-port 8888
        --ssh-port 2222
        --admin-password "{{ warpgate_admin_password }}"
        --external-host "{{ inventory_hostname }}"
    environment:
      WARPGATE_ADMIN_PASSWORD: "{{ warpgate_admin_password }}"
    when: not warpgate_config.stat.exists

  - name: Copy warpgate systemd service file
    become: yes
    copy:
      src: "{{ inventory_dir }}/config/warpgate.service"
      dest: /etc/systemd/system/warpgate.service
      owner: root
      group: root
      mode: '0644'
    notify: 
      - reload systemd
      - restart warpgate

  - name: Copy custom warpgate config file
    copy:
      src: "{{ inventory_dir }}/config/warpgate-config.yaml"
      dest: /etc/warpgate.yaml
      owner: root
      group: root
      mode: '0640'
    notify:
      - restart warpgate

  - name: Enable and start warpgate service
    become: yes
    systemd:
      name: warpgate
      enabled: yes
      state: started

  handlers:
    - name: reload systemd
      systemd:
        daemon_reload: yes
    - name: restart warpgate
      systemd:
        name: warpgate
        state: restarted

Am i missing something in the configuration?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions