Hey there,
I am facing below error when i am trying to access the variables defined in
host_vars/ansible.com.
I have defined variable name in host vars file called "ansible.com" like
---
my_company: cisco
After when i am trying to access the variables inside main.yml under tasks
folder facing below error.
Can anyone support how to fix the issue.
[root@gitserver tasks]# ls
group_vars host_vars main.retry main.yml
[root@gitserver tasks]# ansible-playbook main.yml
PLAY [localhost]
************************************************************************************************************************************************************************************
TASK [Gathering Facts]
******************************************************************************************************************************************************************************
ok: [localhost]
TASK [prints host_vars]
*****************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an
undefined variable. The error was: 'ntp_server' is undefined\n\nThe error
appears to have been in '/home/git/roles/zabbix_agent/tasks/main.yml': line
16, column 6, but may\nbe elsewhere in the file depending on the exact
syntax problem.\n\nThe offending line appears to be:\n\n# debug:
msg=\"My Company name is {{ my_company }}\"\n - name: prints host_vars\n
^ here\n\nexception type: <class
'ansible.errors.AnsibleUndefinedVariable'>\nexception: 'ntp_server' is
undefined"}
to retry, use: --limit
@/home/git/roles/zabbix_agent/tasks/main.retry
PLAY RECAP
******************************************************************************************************************************************************************************************
localhost : ok=5 changed=0 unreachable=0 failed=1
--
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].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/040a9f2c-4db2-49b2-943b-584a0f3ec7b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.