Bug 1575013

Summary: with callback variables configured in /etc/sysconfig/foreman and .../foreman-proxy, facts are not updated
Product: Red Hat Satellite Reporter: Jan Hutař <jhutar>
Component: Ansible - Configuration ManagementAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Lukas Pramuk <lpramuk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.4CC: mhulan
Target Milestone: 6.4.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-16 19:05:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1449011    

Description Jan Hutař 2018-05-04 14:16:40 UTC
Description of problem:
With callback variables configured in /etc/sysconfig/foreman and .../foreman-proxy, facts are not updated


Version-Release number of selected component (if applicable):
satellite-6.4.0-3.beta.el7sat.noarch
rubygem-smart_proxy_ansible-2.0.2-3.el7sat.noarch
tfm-rubygem-foreman_ansible_core-2.0.2-1.el7sat.noarch
tfm-rubygem-foreman_ansible-2.0.4-1.el7sat.noarch
ansible-2.4.2.0-2.el7.noarch


How reproducible:
always


Steps to Reproduce:
1. Have Sat and host with role assigned
2. Configure callbacks on Sat as per https://theforeman.org/plugins/foreman_ansible/2.x/index.html#2.1Ansiblecallback - that means:
   [root@sat640snap1 ~]# tail -n 2 /etc/sysconfig/foreman
   FOREMAN_URL=https://sat640snap1.example.com
   FOREMAN_SSL_VERIFY=False
   [root@sat640snap1 ~]# tail -n 2 /etc/sysconfig/foreman-proxy 
   FOREMAN_URL=https://sat640snap1.example.com
   FOREMAN_SSL_VERIFY=False
   [root@sat640snap1 ~]# grep -e bin_ansible_callbacks -e callback_whitelist /etc/ansible/ansible.cfg 
   #callback_whitelist = timer, mail
   callback_whitelist = foreman
   #bin_ansible_callbacks = False
   bin_ansible_callbacks = True
3. Restart Sat so changes in /etc/sysconfig/... can take effect
   [root@sat640snap1 ~]# katello-service restart
4. Populate facts by manual playbook run as root on the Sat:
   [root@sat640snap1 ~]# whoami
   root
   [root@sat640snap1 ~]# grep -e bin_ansible_callbacks -e callback_whitelist    /etc/ansible/ansible.cfg | grep -v '^#'
   callback_whitelist = foreman
   bin_ansible_callbacks = True
   [root@sat640snap1 ~]# export FOREMAN_URL=https://sat640snap1.example.com
   [root@sat640snap1 ~]# env | grep FOREMAN
   FOREMAN_URL=https://sat640snap1.example.com
   [root@sat640snap1 ~]# ansible --private-key ~foreman-proxy/.ssh/id_rsa_foreman_proxy -i inventory.ini -u root -m setup all
   rhel74.example.com | SUCCESS => {
   [...]
   [root@sat640snap1 ~]# echo $?
   0
5. Check Hosts -> All hosts -> <host> -> Facts -> ansible_date_time and wait
   some time till you see, say, "2 minutes ago" in "Reported at" column
6. Run the role with Hosts -> All hosts -> <host> -> Run Ansible roles
7. Again, check Hosts -> All hosts -> <host> -> Facts -> ansible_date_time


Actual results:
Timestamps in column "Reported at" in step 5. and 7. are almost same (plus the time step 6. took)


Expected results:
In step 7. you should get "less than a minute ago" or something like that. Also values should be changed

Comment 1 Martin Korbel 2018-05-15 07:35:10 UTC
The facts updating by button "Run Ansible roles" (step 6.) does not work  in  generally.

I get this error:

[WARNING]: Failure using method (v2_playbook_on_stats) in callback plugin
(<ansible.plugins.callback.foreman.CallbackModule object at 0x2d88790>):
('Connection aborted.', error(111, 'Connection refused'))
Exit status: 0


Manual running (step 4.) works well and update fact in Satellite.

Comment 4 Martin Korbel 2018-07-18 12:05:32 UTC
VERIFIED on Sat6.4#11

We don't change anything in configuration. All work fine.

Comment 6 Bryan Kearney 2018-10-16 19:05:24 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