I am trying to create an ansible play that
- Establishes if a user exists on a host and records the stdout as a register variable. Referencing a dict file which contains what users should be on the host.
- Creates a group for the user which will be created (with data from the dict) if the stdout == 0
- Creates a user account (with data from the dict) if the stdout == 0
- Copies over a sudoers.d template for a pre-existing ops group
And I saw at https://groups.google.com/forum/#!topic/ansible-project/htHzfr5HzQE that the register is turn into a list when combine in with_items. I can’t seem to figure out how to iterate over a register variable list. Essentially, I’d like for my OpsTeam.yaml variables to correlate with the register variables and use that to determine if action should be taken. Note: this play currently does not work
Here is my code: