On Wednesday, July 23, 2014 5:12:52 PM UTC-5, Michael DeHaan wrote:Hmm, can we see a full playbook so we can understand a bit more in context?
On Wed, Jul 23, 2014 at 5:34 PM, Greg M <mrgrz...@gmail.com <javascript:>>
wrote:
Helo all,
I wonder if I can get some help with referencing facts in template.
I ma not able to reference:
every time I run my play, the file on the host shows:
carp0_ip=””
and the same line in my template:
carp0_ip=”{{ ansible_carp0[“ipv4”][“address”] }}”
this is the snippet from running: ansible server -m setup
"ansible_carp0": {
"device": "carp0",
"flags": [
"UP",
"BROADCAST",
"RUNNING",
"SI
"ipv4": [
{
"address": "10.0.0.33",
"broadcast": "10.0.0.255",
"netmask": "255.255.255.0",
"network": "10.0.0.0"
}
],
"ipv6": [
{
"address": "fe80::200:5eff:fe00:101%carp0",
"prefix": "64",
"scope": "0x4"
}
],
"macaddress": "00:00:5e:00:01:04",
"mtu": "1500",
"status": "master",
"type": "unknown"
},
host where ansible is installed: CentOS 6.5
ansible version: 1.6.6
host I'm pulling facts from: OpenBSD 5.5
Thank you
Greg
--
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 ansible-proje...@googlegroups.com <javascript:>.
To post to this group, send email to ansible...@googlegroups.com
<javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/d4820ae0-eae3-4ad6-aef8-b1570a27d11f%40googlegroups.com<
https://groups.google.com/d/msgid/ansible-project/d4820ae0-eae3-4ad6-aef8-b1570a27d11f%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit
https://groups.google.com/d/optout. Thank you for your replay.
after farther testing i was able to reproduce the error
the error only shows on BSD system (Open, Free)
sample host file:
# ansible host file
#
# testing
openbsd_host ansible_ssh_host=owaa
linux_host ansible_ssh_host=metis
freebsd_host ansible_ssh_host=hosta
[linux_servers]
linux_host
[openbsd_servers]
openbsd_host
[freebsd_servers]
freebsd_host
[freebsd_servers:vars]
ansible_python_interpreter=/usr/local/bin/python2
[openbsd_servers:vars]
ansible_python_interpreter=/usr/local/bin/python
[linux_servers:vars]
ansible_python_interpreter=/usr/bin/python
sample play file:
---
# test.yml
- hosts: linux_host
remote_user: gregm
tasks:
# name: address (frrebsd and openbsd replace with em0 ans nic)
- debug: msg={{ ansible_eth0.ipv4.address }}
when the play is run against linux box:
PLAY [linux_host]
*************************************************************
GATHERING FACTS
***************************************************************
ok: [linux_host]
TASK: [debug msg={{ansible_eth0.ipv4.address}}]
*******************************
ok: [linux_host] => {
"msg": "192.168.0.7"
}
PLAY RECAP
********************************************************************
linux_host : ok=2 changed=0 unreachable=0 failed=0
but when run against any of the BSD system:
PLAY [openbsd_host]
***********************************************************
GATHERING FACTS
***************************************************************
ok: [openbsd_host]
TASK: [debug msg={{ansible_em0.ipv4.address}}]
********************************
ok: [openbsd_host] => {
"msg": "{{ansible_em0.ipv4.address}}"
}
PLAY RECAP
********************************************************************
openbsd_host : ok=2 changed=0 unreachable=0 failed=0
i hope it will help
Thank you
Greg