Hi,
Could someone help me on subjected issue? I have an playbook which works well when running from command line but the same report an issue running from ansible tower.
FAILED! => {“msg”: “The task includes an option with an undefined variable. The error was: ‘ansible.vars.hostvars.HostVarsVars object’ has no attribute ‘sudo’\n\nThe error appears to be in ‘/tmp/awx_117_n_4nr0rt/project/sudoers.yml’: line 46, column 9, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n post_tasks:\n - name: Sending Mail\n ^ here\n”}
Here is my playbook:
-
name: collect sudousers list
shell: cat /etc/sudoers|grep -i “ALL=(ALL”|egrep -v “#”|egrep -v “root|wheel”|awk -vq=“” ‘{print (q $0 q)}’ ORS=‘,’
register: sudo -
name: Sending Mail
mail:
host: test
port: 25