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:
- name: "FS1"
config_files: ["config1","config3","config7"]
- name: "FS3"
config_files:
["config5","config6","config7","config9","config12","config13"]
- name: "FS4"
config_files: ["config1"]
[*host2*.yml]
FS_LISTS:
- name: "FS3"
config_files: ["config1",]
- name: "FS6"
config_files:
["config5","config6","config7","config9","config12","config13"]
- name: "FS7"
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:
>
> On 05. des. 2016 09:45, vu001 wrote:
> > So I started to define FS variable on all hosts or groups if it is
> > possible.
> > Then I created 10 templates. In every template is some host specific
> > variable references.
> > With this simple task I accomplish main idea.
> >
> > - name: Deploy configuration files
> > template: src=config1.j2 dest={{FS }}/config1
> >
> > But I need some ideas how to deploy this on multiple FS on same host. Is
> it
> > possible to define array of FS (somewhere this array would have only one
> > element, somewhere would have 3 elements) and then deploy this on all
> > elements of array (which is basically location on filesystem where to
> > deploy configuration).
>
> Make FS a list, then you can do this
>
> - name: Deploy configuration files
> template: src=config1.j2 dest={{ item }}/config1
> with_items: "{{ FS }}"
>
> --
> Kai Stian Olstad
>
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/c6db94c6-2661-4fc9-a18b-328f69786df6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.