Bug #25361
closedUnable to disable ansible_become_user
Description
I believe when https://projects.theforeman.org/issues/23279 got fixed, we're now always running ansible playbooks (Job category Ansible Playbook) with ansible_become_user set.
This is a problem because Ansible documentation states that if the ansible_become_user is set on the ansible connection (or via inventory), it overrides any other become_user inside the playbook you are running (see https://github.com/ansible/ansible/issues/14199 )
So what I was observing was that my becomes & because_users all got ignored when I ran ansible playbooks via foreman remote execution.
Things I tried:
a. Setting Effective user to blank string in job invocation
b. Setting Host Parameter "ansible_become" to "no" and "ansible_become_user" to blank string
I confirmed if I did something like modify ForemanAnsible::InventoryCreator.host_vars to have
if result['ansible_become'].casecmp('no').zero? result.delete('ansible_become') result.delete('ansible_become_user') end
Then the become/become_user works when running my playbook.