From da97fab4cb781b54405db52c7e00c89a8971bca1 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Fri, 20 Jul 2018 14:27:42 -0400 Subject: [PATCH] ansible: replace yum module by package module when possible Problem: RHEL and CentOS8 will deprecate the usage of Yum. From DNF release note: DNF is the next upcoming major version of yum, a package manager for RPM-based Linux distributions. It roughly maintains CLI compatibility with YUM and defines a strict API for extensions. Solution: Use "package" Ansible module instead of "yum". "package" module is smarter when it comes to detect with package manager runs on the system. The goal of this patch is to support both yum/dnf (dnf will be the default in rhel/centos 8) from a single ansible module. Change-Id: Idfc54d80e5186e9ac5ae02f390328d99c2390491 --- playbooks/roles/octavia-undercloud/tasks/main.yml | 5 ++++- roles/tripleo-bootstrap/defaults/main.yml | 2 +- roles/tripleo-bootstrap/tasks/main.yml | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/playbooks/roles/octavia-undercloud/tasks/main.yml b/playbooks/roles/octavia-undercloud/tasks/main.yml index 96f5619c3..7ed37f46c 100644 --- a/playbooks/roles/octavia-undercloud/tasks/main.yml +++ b/playbooks/roles/octavia-undercloud/tasks/main.yml @@ -11,7 +11,10 @@ - block: - name: install Octavia amphora image if Red Hat - raw: sudo yum -y install octavia-amphora-image + package: + name: octavia-amphora-image + state: present + become: true - name: set location if Red Hat set_fact: image_filename: "/usr/share/rhosp-director-images/octavia-amphora.qcow2" diff --git a/roles/tripleo-bootstrap/defaults/main.yml b/roles/tripleo-bootstrap/defaults/main.yml index 3e1c82ddf..661a367fb 100644 --- a/roles/tripleo-bootstrap/defaults/main.yml +++ b/roles/tripleo-bootstrap/defaults/main.yml @@ -1,7 +1,7 @@ --- # List of packages that are requred to bootstrap TripleO. -# The list is used by `yum` Ansible module, so it takes +# The list is used by `package` Ansible module, so it takes # a comma separated list of packages or (as of 2.0) a list # of packages. packages_bootstrap: diff --git a/roles/tripleo-bootstrap/tasks/main.yml b/roles/tripleo-bootstrap/tasks/main.yml index d955fbc5b..349b6bd3e 100644 --- a/roles/tripleo-bootstrap/tasks/main.yml +++ b/roles/tripleo-bootstrap/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: Deploy required packages to bootstrap TripleO - yum: + package: name: "{{ packages_bootstrap }}" become: true