Make FS a list, then you can do this
- name: Deploy configuration files
template: src=config1.j2 dest={{ item }}/config1
with_items: "{{ FS }}"
Make FS a list, then you can do this
- name: Deploy configuration files
template: src=config1.j2 dest={{ item }}/config1
with_items: "{{ FS }}"
Hi Kai, thanks for help…
your suggestion could be useful, but it is not the best one.
If I have let say 10 hosts and 10 config files, on each host for each FS I need to create list where I specify which config files to deploy on which FS.
i.e.
config1
[host1.yml]
config1: [“FS1”,“FS2”, “FS4”]
[host2.yml]
config1: [“FS5”]
[host3.yml]
config1: [“FS7”,“FS9”]
config2
[host1.yml]
config1: [“FS3”,“FS4”]
[host2.yml]
config1: [“FS7”]
[host3.yml]
config1: [“FS1”,“FS3”]
That is to complicate because I have more than 30 hosts, and more than 20 config files.
My idea was to define list of FS-s in inventory file for each host
[host1.yml]
FS_LISTS:
config_files: [“config1”,“config3”,“config7”]
config_files: [“config5”,“config6”,“config7”,“config9”,“config12”,“config13”]
config_files: [“config1”]
[host2.yml]
FS_LISTS:
config_files: [“config1”,]
config_files: [“config5”,“config6”,“config7”,“config9”,“config12”,“config13”]
config_files: [“config1”,“config12”,“config13”]
It’s simple when I want to deploy only one config file to each FS.
template: src=config1.j2 dest={{ item.name }}/config1
with_items: “{{MEMBERS_LIST}}”
But I can’t figure out how to deploy all config files specified for some host, not just config1.
How to permutate FS_LIST.name with every element of list FS_LIST.config_files
I want this on host1
FS1 config1
FS1 config2
FS1 config3
FS3 config5
FS3 config6
FS3 config7
FS3 config9
FS3 config12
FS3 config13
How to nest that to lists, and do this permutation.
Thanks a lot
but I’m searching for better solution.
Dana srijeda, 7. prosinca 2016. u 19:47:25 UTC+1, korisnik Kai Stian Olstad napisao je: