copy module wildcards

4,604 views
Skip to first unread message

Dader Grund

unread,
Sep 5, 2016, 4:45:25 AM9/5/16
to Ansible Project
Example :
- name: copying only .conf files
    copy: src={{ item.0 }} dest={{ item.1 }}
    with_together:
     - [ '/file1/foo/*.conf', /file1/foo/*.txt' ]
     - [ '/etc/boo/', '/etc/goo' ]

I have a folder with a lot of conf files or other file extension and i need to copy them to different folders on the server.
In Ansible's docs there only the hint using wildcards in host file. Apparently this doesn't work in copy module.
Is there any way to use wildcard or regex in this module rather than having to right a module for each file ?

Kai Stian Olstad

unread,
Sep 5, 2016, 8:30:58 AM9/5/16
to ansible...@googlegroups.com
To use copy with wildcard, check out with_fileglob
http://docs.ansible.com/ansible/playbooks_loops.html#id4

--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages