Skip to content

Idempotency issue with admin user on final step #14

@ldelelis

Description

@ldelelis

Re-applying the role to a host in which it already was applied with bastion_create_admin: true causes its final step to fail, erroring about the admin account already existing.

Step execution logs:

TASK [adamsbytes.ovhbastion : complete initial account setup] *********************************
fatal: [redacted]: FAILED! => changed=true
  cmd: /opt/bastion/bin/admin/setup-first-admin-account.sh [redacted]-admin auto
  delta: '0:00:00.370691'
  end: '2021-03-30 13:23:18.470109'
  msg: non-zero return code
  rc: 100
  start: '2021-03-30 13:23:18.099418'
  stdout: |-
    [1;34m---s1-4-us-east-va-1--------------------------------------the-bastion-3.03.00---
    [0m[34m=> create a new bastion account
    [0m[34m--------------------------------------------------------------------------------
    [0m[34m~ [0mPlease paste the SSH key you want to add. This bastion supports the following algorithms:
    [34m~ [0mED25519: strongness[#####] speed[#####], use `ssh-keygen -t ed25519' to generate one
    [34m~ [0mECDSA  : strongness[####.] speed[#####], use `ssh-keygen -t ecdsa -b 521' to generate one
    [34m~ [0mRSA    : strongness[###..] speed[#....], use `ssh-keygen -t rsa -b 4096' to generate one
    [34m~ [0m
    [34m~ [0mIn any case, don't save it without a passphrase (your paste won't be echoed).

    [31;1m~ The account [redacted]-admin already exists[0m
    [1;34m-------------------------------------------------------------</accountCreate>---
    [0m
  stdout_lines: <omitted>

Would adding an extra check for a UNIX user matching the admin name be a good idea to avoid this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions