(list in the loop)
On Fri, 22 May 2020 23:58:06 +0200
Vladimir Botka <
vbo...@gmail.com> wrote:
> > > > > - set_fact:
> > > > > my_users: "{{ my_users|default([]) + my_vars.users }}"
> > > > > loop:
> > > > > - group_vars/all
> > > > > - group_vars/postgresql.yml
> > > > > - host_vars/server1
> > > > > vars:
> > > > > my_vars: "{{ lookup('file', item)|from_yaml }}"
> > > > Thanks that works , I wish it was cleaner though. Appreciate the help
> > > You're welcome. Just curious what might be cleaner? Could you describe your
> > > idea in any language, or meta perhaps?
> > In puppet using hiera you can use hiera hash which merges the matches.
> > It's useful in many cases another example would be if you managing
> > iptables. You would want one rule for all servers example allow port 22 and
> > and other rules based on type of server example 5432 for PostgreSQL. I
> > don't want to duplicate port 22 in all my server types. One reason for this
> > if someone added a new server type they might miss a port. Hope this make
> > sense :)
> >
https://ask.puppet.com/question/13592/when-to-use-hiera-hiera_array-and-hiera_hash/
> There is hiera lookup plugin in Ansible.
>
https://docs.ansible.com/ansible/latest/plugins/lookup/hiera.html#hiera-get-info-from-hiera-data
> Would it be possible to post the [mcve] Puppet code of your example? At gist
> perhaps? I'd like to try and translate it to Ansible with the hiera plugin,
> and to see what's cleaner. Hope this makes also sense :)
> [mcve]
https://stackoverflow.com/help/minimal-reproducible-example