This is driving me crazy. My playbook looks as follows:
---
- hosts: all
become_user: root
become_method: sudo
become: yes
vars:
ansible_become_password: "{{ ansible_password }}"
ansible_password is a variable that is supposed to be populated by Ansible Tower / AWX. But I am getting below error message:
fatal: [RHEL8]: FAILED! => {"msg": "The field 'become_pass' has an invalid
value, which includes an undefined variable. The error was: 'ansible_password' is undefined"}
It tells me that ansible_password is undefined. But if I a hardcode the password there and log ansible_password at the end of the playbook execution, i see that ansible_password is well defined. So, it seems like ansible_password is only defined in the scope of tasks.
Anybody has experience with this? What would be the way around this issue?