How to add a user to a list of groups using Ansible

How to add a user to a list of groups using an Ansible playbook using the user module:

 - name: Add Users to libvirt
   action: user name=myuser groups="adm,sudo,kvm,libvirtd" append=yes

If you have set append to yes – the groups will be added to the list of existing groups. If append = no then just the list in groups with a set for the user.

Leave a Reply