Project

General

Profile

Actions

Bug #25361

closed

Unable to disable ansible_become_user

Added by A W over 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

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.

Actions

Also available in: Atom PDF