cat ntp.conf.j2
driftfile /var/lib/ntp/drift
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
{% for key in SITE[ntp][0] %}
{{key}}
{% endfor %}
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
ansible-playbook -i hosts main.yml --connection=local
PLAY [test template] **********************************************************
GATHERING FACTS ***************************************************************
ok: [localhost]
TASK: [debug var={{SITE}}] ****************************************************
ok: [localhost] => {
"var": {
"boston": {
"nameservers": [
"10.0.0.1",
"10.0.0.2"
],
"ntp": [
]
}
}
}
TASK: [Template Test] *********************************************************
fatal: [localhost] => {'msg': 'AnsibleUndefinedVariable: One or more undefined variables: unicode object has no element Undefined', 'failed': True}
fatal: [localhost] => {'msg': 'AnsibleUndefinedVariable: One or more undefined variables: unicode object has no element Undefined', 'failed': True}
FATAL: all hosts have already failed -- aborting
PLAY RECAP ********************************************************************
to retry, use: --limit @/Users/dave/main.retry
localhost : ok=2 changed=0 unreachable=1 failed=0