Bug 1829487

Summary: Ansible verbosity level does not work
Product: Red Hat Satellite Reporter: mithun kalyat <mkalyat>
Component: Ansible - Configuration ManagementAssignee: Nagoor Shaik <nshaik>
Status: CLOSED ERRATA QA Contact: Lukas Pramuk <lpramuk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.7.0CC: egolov, ehelms, nshaik, pcreech
Target Milestone: 6.8.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-foreman_ansible_core-3.0.4 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-27 13:02:11 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:

Description mithun kalyat 2020-04-29 15:54:07 UTC
Description of problem:

With Satellite 6.7, ansible-runner is the default implementation of running playbooks. It seems we missed adding the code to append the verbosity to the ansible-runner.

Version-Release number of selected component (if applicable):

Red Hat Satellite 6.7

Comment 3 Bryan Kearney 2020-04-30 12:15:30 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/29627 has been resolved.

Comment 4 Lukas Pramuk 2020-09-21 22:32:40 UTC
FailedQA.

@Satellite 6.8.0 Snap16
tfm-rubygem-foreman_ansible_core-3.0.3-1.el7sat.noarch

by the following manual reproducer:

1) Set ansible verbosity level to 'Level 4' (-vvvv) at Administer -> Settings -> tab Ansible - item 'Default verbosity level' 

2) Run ansible REX command "sleep 1000" against a host 

3) Check with what params ansible-runner runs

# ps -efH | grep -A3 [/]smart_proxy_dynflow_core
foreman+  2455     1  0 Sep18 ?        00:01:35   ruby /usr/bin/smart_proxy_dynflow_core --no-daemonize
foreman+ 11441  2455  0 18:07 pts/1    00:00:00     /usr/bin/python2 /usr/bin/ansible-runner run /tmp/d20200921-2455-whv99n -p playbook.yml
foreman+ 11446 11441 12 18:07 pts/2    00:01:18       /usr/bin/python2 /usr/bin/ansible-playbook -i /tmp/d20200921-2455-whv99n/inventory playbook.yml
foreman+ 11906 11446  0 18:07 pts/2    00:00:00         /usr/bin/python2 /usr/bin/ansible-playbook -i /tmp/d20200921-2455-whv99n/inventory playbook.yml

>>> ansible-runner is not run with -vvvv

Note:

# ansible-playbook -h | grep -A1 '\-v[, ]'
  -v, --verbose         verbose mode (-vvv for more, -vvvv to enable
                        connection debugging)
# ansible-runner -h | grep -A1 '\-v[, ]'
  -v                    increase the verbosity with multiple v's (up to 5) of
                        the ansible-playbook output (default=None)

>>> ansible-runner has maximal verbosity 5 (used by satellite) while ansible-playbook has maximal verbosity only 4

Comment 5 Lukas Pramuk 2020-09-21 22:36:18 UTC
Oops.

The fix is not present, rel-eng failure:

# grep -A4 'def start_ansible_runner' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_ansible_core-*/lib/foreman_ansible_core/runner/ansible_runner.rb
      def start_ansible_runner
        command = ['ansible-runner', 'run', @root, '-p', 'playbook.yml']
        initialize_command(*command)
        logger.debug("[foreman_ansible] - Running command '#{command.join(' ')}'")
      end

>>> the line from fix "command << verbosity if verbose?" is missing

Comment 6 Marek Hulan 2020-09-22 14:37:10 UTC
We need to pull in newer foreman_ansible_core, I'll work on a new 3.0.4 release and will update the BZ shortly.

Comment 7 Marek Hulan 2020-09-22 14:56:42 UTC
New version with the fix published, packaging PR opened at https://github.com/theforeman/foreman-packaging/pull/5836

Comment 8 Lukas Pramuk 2020-10-06 07:38:30 UTC
VERIFIED.

@Satellite 6.8.0 Snap18
tfm-rubygem-foreman_ansible_core-3.0.4-1.el7sat.noarch

by the following manual reproducer:

1) Set ansible verbosity level to 'Level 4' (-vvvv) at Administer -> Settings -> tab Ansible - item 'Default verbosity level' 

2) Run ansible REX command "sleep 1000" against a host 

3) Check with what params ansible-runner runs

# ps -efH | grep -A3 [/]smart_proxy_dynflow_core
foreman+ 11286     1  0 Oct03 ?        00:01:16   ruby /usr/bin/smart_proxy_dynflow_core --no-daemonize
foreman+ 73414 11286  0 03:33 pts/1    00:00:00     /usr/bin/python2 /usr/bin/ansible-runner run /tmp/d20201006-11286-1jo2m29 -p playbook.yml -vvvv
foreman+ 73420 73414  6 03:33 pts/2    00:00:03       /usr/bin/python2 /usr/bin/ansible-playbook -i /tmp/d20201006-11286-1jo2m29/inventory -vvvv playbook.yml
foreman+ 73643 73420  0 03:33 pts/2    00:00:00         /usr/bin/python2 /usr/bin/ansible-playbook -i /tmp/d20201006-11286-1jo2m29/inventory -vvvv playbook.yml

>>> ansible-runner is run with -vvvv

Comment 11 errata-xmlrpc 2020-10-27 13:02:11 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 (Important: Satellite 6.8 release), 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-2020:4366