Project

General

Profile

Actions

Bug #29260

closed

Katello Ansible Template for yum package install missing yes flag

Added by Thomas Herbin almost 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

Hi there,

I modified REX Behavior via the "REX Features" to use "Katello Ansible Default" Templates instead of the "Katello SSH Default"
So, From the Katello GUI, on a content Host, and selecting the "Upgrade Selected" triggers an Ansible Tasks

The "Update Package - Katello Ansible Default" Job template is used. However this hangs indefinitely on my host. I found out why. The Template generate the following Ansible task :

---
- hosts: all
  tasks:
    - shell:
        cmd: |
          yum update $USER_INPUT[package]
      register: out
    - debug: var=out

Because the "shell" is used and not the Ansible Yum plugin, the missing "-y" means that the host doesn't update packages.
Adding the -y fixes the problem.
For example the following :

<%= render_template('Run Command - Ansible Default', :command => "yum update -y #{input('package')}") %>

Works nicely.

This error appears in multiple other templates :
  • Install Errata - Katello Ansible Default
  • Install Group - Katello Ansible Default
  • Remove Group - Katello Ansible Default
  • Update Group - Katello Ansible Default
  • Update Package - Katello Ansible Default

The only template not impacted is : "Install Package - Katello Ansible Default".
This is Due to the fact that the template doesn't use the Ansible shell tasks, it uses the Package module, which is maybe the way forward to fix the other templates ?

Best Regards

Actions

Also available in: Atom PDF