ansible-role-ntp
ansible-role-ntp copied to clipboard
Make geerlingguy.ntp inject_facts_as_vars friendly
Setting inject_facts_as_vars = False
is considered safer because a compromised host cannot inject facts into variables. However, the code fails when this is set:
{"msg": "The task includes an option with an undefined variable. The error was: 'ansible_os_family' is undefined\n\nThe error appears to be in '/root/.ansible/roles/geerlingguy.ntp/tasks/main.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: Include OS-specific variables.\n ^ here\n"}
Since using ansible_os_family
only works when inject_facts_as_vars = True
and ansible_facts['os_family']
works regardless of the setting of inject_facts_as_vars
, wouldn't it be sensible to systematically use the ansible_facts[*]
syntax ?