Let's see what facts you do have ....

ansible -m setup -i <inventory_filename> <hostanme> -a "filter=*ipv4*"

On 12/02/2013 02:48 PM, Steven Truong wrote:
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.
--
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].
For more options, visit https://groups.google.com/groups/opt_out.

--
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].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to