Kenady,
I think you are looking to loop[1] the users correct?
aka
loop: "{{ users }}"
1. https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html
On Tue, Nov 1, 2022 at 10:31 AM Kenady Inampudi <[email protected]> wrote:
> Archiving user home directories
>
> user.yml
> ---
> user:
> - user1
> - user2
>
> archive_home_dir.yml
> ---
> - hosts: all
> tasks:
> - archive:
> path: /home/{{ user }}
> dest: /home/archive/{{ user }}.tar.gz
> format: gz
> ansible-playbook archive_home_dir.yml -e @user.yml
>
> i get
> -rw-r--r-- 1 root system 88 Nov 01 11:58 [u'user1',
> u'user2'].tar.gz
>
> i was expecting
> -rw-r--r-- 1 root system 88 Nov 01 11:58 user1.tar.gz
> -rw-r--r-- 1 root system 88 Nov 01 11:58 user2.tar.gz
>
> --
> 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/3df53de7-82a5-4430-9146-8c03755f923an%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/3df53de7-82a5-4430-9146-8c03755f923an%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
- Andrew "lathama" Latham -
--
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/CA%2Bqj4S_gPDKJbY7os4VzFiDKe%2BG%2BOXe712FbR4sHMGLSGw1-SQ%40mail.gmail.com.