any idea how I can create a user and then put it into multiple groups with 
jinja2?

- name: create user sam
  ansible.builtin.user:
    name: '{{ username }}'
    shell: '{{ shell }}'
    generate_ssh_key: yes
    create_home: yes
    groups: "'{{ username }}','{{ groupname }}'"
    append: yes  
    ssh_key_file: .ssh/id_rsa
  become: true


where {{ username }} is sam 
{{ groupname }} is docker


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5bb32ddb-57be-4133-aa03-22a1ff06a542n%40googlegroups.com.

Reply via email to