Bug 1589819

Summary: when running ansible job become is not working
Product: Red Hat Satellite Reporter: Lukas Pramuk <lpramuk>
Component: Ansible - Configuration ManagementAssignee: Daniel Lobato Garcia <dlobatog>
Status: CLOSED ERRATA QA Contact: Lukas Pramuk <lpramuk>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.4CC: bkearney, inecas, jhutar, mhulan, pcreech
Target Milestone: 6.4.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: foreman_ansible-2.2.2 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-16 19:17:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lukas Pramuk 2018-06-11 12:55:11 UTC
effective user (both real or nonsense) is ignored and root is always used.
While for SSH provider this works.

Comment 1 Lukas Pramuk 2018-06-11 12:55:16 UTC
Created from redmine issue http://projects.theforeman.org/issues/23279

Comment 4 Satellite Program 2018-07-09 16:02:49 UTC
Upstream bug assigned to dlobatog

Comment 5 Satellite Program 2018-07-09 16:02:51 UTC
Upstream bug assigned to dlobatog

Comment 6 Satellite Program 2018-07-11 16:02:45 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/23279 has been resolved.

Comment 7 Lukas Pramuk 2018-07-16 13:09:26 UTC
VERIFIED.

@satellite-6.4.0-10.beta.el7sat.noarch
tfm-rubygem-foreman_ansible-2.2.3-1.el7sat.noarch
tfm-rubygem-foreman_ansible_core-2.1.0-1.el7sat.noarch
rubygem-smart_proxy_ansible-2.0.2-3.el7sat.noarch
ansible-2.6.1-1.el7ae.noarch

by the manual reproducer:

1) Have a SAT with Host registerred and setup for REX (ssh key is authorized)

2) @Host: # adduser test

3) Schedule Ansible Command job against the Host and with 
- command* [echo $USER]
- Effective user [test]

4) Check job output for the Host
100 % success
----
 1:
PLAY [all] *********************************************************************
   2:
   3:
TASK [Gathering Facts] *********************************************************
   4:
ok: [host1.example.com]
   5:
TASK [shell] *******************************************************************
   6:
changed: [host1.example.com]
   7:
   8:
TASK [debug] *******************************************************************
   9:
ok: [host1.example.com] => {
  10:
"out": {
  11:
"changed": true,
  12:
"cmd": "echo $USER",
  13:
"delta": "0:00:00.002638",
  14:
"end": "2018-07-16 08:51:55.153172",
  15:
"failed": false,
  16:
"rc": 0,
  17:
"start": "2018-07-16 08:51:55.150534",
  18:
"stderr": "",
  19:
"stderr_lines": [],
  20:
"stdout": "test",
  21:
"stdout_lines": [
  22:
"test"
  23:
]
  24:
}
  25:
}
  26:
  27:
PLAY RECAP *********************************************************************
  28:
host1.example.com : ok=3 changed=1 unreachable=0 failed=0
  29:
Exit status: 0
----

"stdout": "test"  >>> effective user was successfully applied

Comment 8 Bryan Kearney 2018-10-16 19:17:12 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:2927