The
host
parameter is the F5 device the want to pass the module task to, in this case is a variable passed it it.
With Ansible
gather_facts
is set to 'on' (it is on by default) then you have access to a load of variables you can use in your playbooks.
With
gather_facts
you should get a dictionary variable set named
ansible_default_ipv4
which would look like the following:
"ansible_default_ipv4": {
"address": "10.0.0.1",
"alias": "eth0",
"gateway": "10.0.0.254",
"interface": "eth0",
"macaddress": "REDACTED",
"mtu": 1500,
"netmask": "255.255.255.0",
"network": "REDACTED",
"type": "ether"
},
You can then use
ansible_default_ipv4.address
or
ansible_default_ipv4['address']
to reference the address index of the dictionary.
In your playbooks you will need to use
"{{ansible_default_ipv4.address}}"
or
"{{ansible_default_ipv4['address']}}"
See Ansible 2.6 Playbook Vaiables for more information.