I need to install configuration files for an application on multiple hosts,
where
(1) each host needs a different collection of files, and
(2) each file may have different content for each host.
I have the following file layout:
./roles/myapp/files/host01/foo.conf
./roles/myapp/files/host02/foo.conf
./roles/myapp/files/host02/bar.conf
etc etc.
In ./roles/myapp/tasks/main.yml, I want something like the following task:
- name: install config files
copy: dest=/etc/myapp/{{ item }} src={{ ansible_hostname }}/{{ item }}
with_fileglob:
- "{{ ansible_hostname }}/*.conf"
The problem is that the "with_fileglob" line sets {{ item }} to an absolute
filename like
/path/to/my/dir/roles/files/host01/foo.conf
which must be copied to /etc/myapp/foo.conf on the host01 system.
Is there some way I can extract just the 'foo.conf' part of the full name,
or does ansible have
a different way to perform such a task?
--
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].
For more options, visit https://groups.google.com/groups/opt_out.