Hi,
Ansible can be a slippery fish to grab, but I’m slowly and steadily getting a grip. Here’s my Ansible repository with a handful of roles for post-install server configuration:
I’d like to add a user_setup
role for basic post-install user setup. Here’s what it should do:
-
IF there is no user with an UID of 1000
-
AND IF there is no user
microlinux
on the system -
THEN create user
microlinux
with and UID of 1000
I’ve already got the part where I set the password and group membership, which looks like this:
- name: "Configure admin user: microlinux"
ansible.builtin.user:
name: microlinux
groups: wheel
password: >-
{{passwd_microlinux |
password_hash('sha512', 65534 |
random(seed=inventory_hostname) |
string) }}
What I’m missing now is the two conditions above in Ansible syntax. How would I express these ?
Cheers,
Niki