I need to create users inputting from 2 list files as below:
cat user.yml
user1
user2
user3
cat group.yml
group1
group2
group3
cat playbook.yml
- name: Add the user
user:
name: "{{ item[0] }}"
group: "{{ item[1] }}"
with_nested:
- cat user.yml
- cat group.yml
The two files will get inputs dynamically from other tasks, so I will not be able to mention the list in ['user1', 'user2'] like that. Kindly suggest how to cat two lists using with_nested
Q: "Cat two lists using with_nested."
A: For example
gives
The same result gives the pipe lookup plugin, .e.g.
Lookup plugins "... like all templating, lookups execute and are evaluated on the Ansible control machine."
If the files are stored on the remote host, e.g.
read the files from the remote host first, e.g.
gives the same result