Re: [ansible-project] How can i get ip addresses of group hostnames

2020-06-02 Thread Vladimir Botka
On Tue, 2 Jun 2020 03:57:57 -0700 (PDT) Arko Köst wrote: > So what should i do? Collect facts from all hosts and find items that fit the purpose. -- Vladimir Botka -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this

Re: [ansible-project] How can i get ip addresses of group hostnames

2020-06-02 Thread Arko Köst
So what should i do? teisipäev, 2. juuni 2020 13:49.49 UTC+3 kirjutas Vladimir Botka: > > On Tue, 2 Jun 2020 03:37:06 -0700 (PDT) > Arko Köst > wrote: > > > Here it works, but on another environment it gives error > > Version is 2.9.9 > > What facts are available depends on the configuration

Re: [ansible-project] How can i get ip addresses of group hostnames

2020-06-02 Thread Vladimir Botka
On Tue, 2 Jun 2020 03:37:06 -0700 (PDT) Arko Köst wrote: > Here it works, but on another environment it gives error > Version is 2.9.9 What facts are available depends on the configuration of the remote host. It might be tricky to find a working template in heterogeneous environment. --

Re: [ansible-project] How can i get ip addresses of group hostnames

2020-06-02 Thread Arko Köst
{% for item in groups['docker_servers']-%} {{ hostvars[item]['ansible_default_ipv4']['address'] }} {% endfor %} - name: Configure pg_hba template:src: test.txt.j2dest: /tmp/groups.txt tags: - install_docker [root@worker-server ~]# cat /tmp/groups.txt 10.5.0.15 Here it works,

Re: [ansible-project] How can i get ip addresses of group hostnames

2020-06-02 Thread Arko Köst
I've found a working one, it does work on another cluster, but doesn't work in my environment. Template: {% for item in groups['nodes']-%} {{ hostvars[item]['ansible_default_ipv4']['address'] }} {% endfor %} - hosts: opmon tasks: - name: Configure pg_hba template: src:

Re: [ansible-project] How can i get ip addresses of group hostnames

2020-06-02 Thread Vladimir Botka
On Tue, 2 Jun 2020 02:45:41 -0700 (PDT) Arko Köst wrote: > ... get ip addresses of hosts in specific group > - hosts: opmon > > I need, that node1.itarchive.home will be in IP > Something like that: > host 'op-monitor' opmonitor 192.168.0.95/24 md5' As a hint, try "template" shell> cat