I just started using Ansible. Is there a Best Practice when managing multiple users accounts with Ansible; (e.g; creating, disabling, and removing user accounts). I thought, managing accounts from a csv file would be earlier. I haven't been able to find any reference or examples.
I created the following test below. But for usability, it seems it would be easier to run this against a csv file, and not have to edit the yml file every time.
- hosts: servers
remote_user: root
tasks:
- name: adding several users
user:
name={{ item.name }}
state=present
comment={{ item.comment }}
password=$1$*)^%$CeUUJM&v#0pQhHjqjpqX1
update_password=on_create
createhome=yes
groups={{ item.groups }}
with_items:
- { name: 'testuser3', comment: 'testuser3', groups: 'wheel' }
- { name: 'testuser4', comment: 'testuser4', groups: 'users' }
Thank you for your help.