Bug 1725817

Summary: Ansible Power job fails silently
Product: Red Hat Satellite Reporter: hprakash
Component: Ansible - Configuration ManagementAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Ondrej Gajdusek <ogajduse>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.5.0CC: dmatoule, nshaik, ogajduse, quentin.equinet, rankumar, shisingh, susalvi
Target Milestone: 6.9.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: 2021-04-21 13:11:48 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 hprakash 2019-07-01 13:44:10 UTC
Description of problem:
Ansible power playbooks i.e. reboot action on the hosts are not working on hosts

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


How reproducible:
Always

Steps to Reproduce:
Web UI>Hosts>select host>from 'Select Actions' drop down, select 'Schedule Remote Jobs'>select 'Ansible Power', 'Power Action - Ansible Default', 'restart' fore 'Job category', 'Job template' and 'action' attributes respectively


Actual results:
corresponding 'Actions::RemoteExecution::RunHostsJob' job gets completed successfully but host restart did not happen.

Expected results:
Host should be restarted

Additional info:

Comment 4 Bryan Kearney 2019-07-01 14:01:26 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/591 has been resolved.

Comment 6 Ranjan Kumar 2020-01-08 08:13:39 UTC
The multi-line script doesn't work using '|' with the command module. 

Workaround:
 
Modify job template "Power Action - Ansible Default - Ansible " like below

---
- hosts: all
  tasks:
    - shell: |
        echo <%= input('action') %> host && sleep 3
        <%= case input('action')
          when 'restart'
            'shutdown -r +1'
          else
            'shutdown -h +1'
          end %>

Comment 7 Nagoor Shaik 2020-01-09 05:22:09 UTC
PR opened upstream https://github.com/theforeman/community-templates/pull/592

Comment 8 Dominik Matoulek 2020-06-10 11:32:55 UTC
Created redmine issue https://projects.theforeman.org/issues/30091 from this bug

Comment 9 Bryan Kearney 2020-06-10 12:02:04 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/30091 has been resolved.

Comment 10 Brad Buckingham 2020-11-13 19:21:49 UTC
Fix is in Satellite 6.9 SNAP 1 with tfm-rubygem-foreman_ansible-6.0.0-1.el7sat.noarch

Comment 11 Ondrej Gajdusek 2021-02-22 14:59:34 UTC
Provided fix fixes the behavior.

VERIFIED using the reproducer in the description. After the job is invocated, the host is rebooted and the job's status changes to 'success' after the host reboots.

Comment 14 errata-xmlrpc 2021-04-21 13:11:48 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 (Moderate: Satellite 6.9 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-2021:1313