I am new to Ansible, I have been searching all through the web for this info, but I couldn’t able to get it correctly.
I am trying to get the IP address of the machine (local) with some variable under tasks/main.yml file using $tag, tag is a variable name, but I am not able to get it.
Thanks for the quick response, but that didn’t help. I get the below error,
Error:
TASK [conf : lineinfile] ******************************************************************************
task path: /home/elastic/ansible/roles/conf/tasks/main.yml:61
fatal: [localhost]: FAILED! => {
“failed”: true,
“msg”: “the field ‘args’ has an invalid value, which appears to include a variable that is undefine
d. The error was: ‘tag’ is undefined\n\nThe error appears to have been in ‘/home/elastic/ansible/roles/
conf/tasks/main.yml’: line 61, column 3, but may\nbe elsewhere in the file depending on the exact synta
x problem.\n\nThe offending line appears to be:\n\n\n- lineinfile:\n ^ here\n”
}
to retry, use: --limit @/home/elastic/ansible/sample.retry
PLAY RECAP ********************************************************************************************
localhost : ok=12 changed=0 unreachable=0 failed=1