It might be a dumb question but I can't get this to work. I want to print
IP address of my control node in all nodes.
Lets say I have this in hosts:
[webservers]
10.10.10.1
10.10.10.2
10.10.10.3
When I run my "ansible-playbook -s myCode.yml" on 10.10.10.1 I want to see
my debug line says:
ok: [10.10.10.1] => var = 10.10.10.1
ok: [10.10.10.2] => var = 10.10.10.1
ok: [10.10.10.3] => var = 10.10.10.1
I have done something like this but didn't work:
- set_fact:
myIP: "{{ ansible_all_ipv4_addresses.split[0] }}"
when: inventory_hostname == groups["serserver"][0]
This actually prints: 10.10.10.1 10.10.10.2 10.10.10.3
Thanks in advance.
--
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/e5dd318a-ee88-4d29-a12c-12cbc1ea3810%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.