Hi all,
Using the info from the document, I tried this but this totally does not work. I tried a few different varibles such as ansible_ipv4 and nothing seemed to work.
{% for host in groups[‘iad2-ads’] %}
server {{ inventory_hostname }} {{ hostvars[host][‘ansible_all_ipv4_address’] }}:80 check
{% endfor %}
Output:
fatal: [iad2-lb2] => {‘msg’: “One or more undefined variables: ‘dict’ object has no attribute ‘ansible_all_ipv4_address’”, ‘failed’: True}
fatal: [iad2-lb2] => {‘msg’: “One or more undefined variables: ‘dict’ object has no attribute ‘ansible_all_ipv4_address’”, ‘failed’: True}
fatal: [iad2-lb3] => {‘msg’: “One or more undefined variables: ‘dict’ object has no attribute ‘ansible_all_ipv4_address’”, ‘failed’: True}
fatal: [iad2-lb3] => {‘msg’: “One or more undefined variables: ‘dict’ object has no attribute ‘ansible_all_ipv4_address’”, ‘failed’: True}
fatal: [iad2-lb4] => {‘msg’: “One or more undefined variables: ‘dict’ object has no attribute ‘ansible_all_ipv4_address’”, ‘failed’: True}
fatal: [iad2-lb4] => {‘msg’: “One or more undefined variables: ‘dict’ object has no attribute ‘ansible_all_ipv4_address’”, ‘failed’: True}
fatal: [iad2-lb1] => {‘msg’: “One or more undefined variables: ‘dict’ object has no attribute ‘ansible_all_ipv4_address’”, ‘failed’: True}
fatal: [iad2-lb1] => {‘msg’: “One or more undefined variables: ‘dict’ object has no attribute ‘ansible_all_ipv4_address’”, ‘failed’: True}
FATAL: all hosts have already failed – aborting
Here is the output from module setup and it clearly show that this variable is available…
ansible iad2-ads -m setup |grep ansible_all_ipv4_address
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
“ansible_all_ipv4_addresses”: [
Please help.
Thanks,
Steven.