Hi! I’m still learning Ansible. I need help with recursively replacing strings in a directory.
Will this code work?
- replace:
dest: "/home/ansible/cloning/*"
regexp: "{{ansible_hostname}}"
replace: "{{ansible_system}"
with_filetree: "/home/ansible/cloning/"
Thanks!
system
(system)
2
you need to specify the file, which is contained in the 'item'
variable produced by the loop:
- replace:
dest: "/home/ansible/cloning/{{item}}"
regexp: "{{ansible_hostname}}"
replace: "{{ansible_system}"
with_filetree: "/home/ansible/cloning/"