You can use groups_vars for any group in your inventory

Enviado desde mi iPhone

> El 01-07-2022, a la(s) 13:32, Tony Wong <[email protected]> escribió:
> 
> 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.

-- 
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/92CA3B1C-B5AE-4DE9-AD3E-72C3D3FF0D71%40gmail.com.

Reply via email to