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
This commit is contained in:
Emilien Macchi 2018-07-20 14:27:42 -04:00
parent c11523bdbf
commit da97fab4cb
3 changed files with 6 additions and 3 deletions

View File

@ -11,7 +11,10 @@
- block: - block:
- name: install Octavia amphora image if Red Hat - 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 - name: set location if Red Hat
set_fact: set_fact:
image_filename: "/usr/share/rhosp-director-images/octavia-amphora.qcow2" image_filename: "/usr/share/rhosp-director-images/octavia-amphora.qcow2"

View File

@ -1,7 +1,7 @@
--- ---
# List of packages that are requred to bootstrap TripleO. # 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 # a comma separated list of packages or (as of 2.0) a list
# of packages. # of packages.
packages_bootstrap: packages_bootstrap:

View File

@ -1,7 +1,7 @@
--- ---
- name: Deploy required packages to bootstrap TripleO - name: Deploy required packages to bootstrap TripleO
yum: package:
name: "{{ packages_bootstrap }}" name: "{{ packages_bootstrap }}"
become: true become: true