On Tue, 2 Jun 2020 02:45:41 -0700 (PDT) Arko Köst <[email protected]> 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 pg_hba.conf.j2
{% for host in groups['opmon'] %}
host {{ host }} opmonitor {{ hostvars[host]['ansible_all_ipv4_addresses'] }}
{% endfor %}
and playbook
shell> cat pb.yml
- hosts: opmon
gather_facts: true
tasks:
- template:
src: pg_hba.conf.j2
dest: /tmp/pg_hba.conf
delegate_to: localhost
run_once: true
Take a look at the facts collected by "setup" and fit the template to your
needs. See what facts are available
shell> ansible remote_host -m setup
HTH,
-vlado
--
Vladimir Botka
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/20200602122749.170426f0%40gmail.com.
pgphewarQClit.pgp
Description: OpenPGP digital signature
