Replace apt/yum ansible modules, use package instead

apt/yum use is not convenient, package module automatically uses
the underlying OS package manager. Also, some ansible roles currently
use only apt module without yum, therefore patch fixes this bug too.

Change-Id: I5dd49d513d1a791ab51ca6ce6eb1c079542c5624
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
This commit is contained in:
Ruslan Aliev 2020-06-26 03:54:52 -05:00
parent 901c314f02
commit 876c6043ee
9 changed files with 46 additions and 59 deletions

View File

@ -13,7 +13,7 @@
- hosts: primary - hosts: primary
tasks: tasks:
- name: Install python setuptools - name: Install python setuptools
apt: package:
name: name:
- python3-pip - python3-pip
- python3-setuptools - python3-setuptools

View File

@ -11,12 +11,11 @@
# limitations under the License. # limitations under the License.
- name: Install python3-docker and python3-requests Modules - name: Install python3-docker and python3-requests Modules
apt: package:
pkg: name:
- python3-docker - python3-docker
- python3-requests - python3-requests
state: present state: present
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: List Docker Images - name: List Docker Images
shell: docker image ls shell: docker image ls

View File

@ -15,7 +15,7 @@
become: yes become: yes
block: block:
- name: Ensure needed packages - name: Ensure needed packages
apt: package:
name: name:
- python3-passlib - python3-passlib
state: present state: present

View File

@ -11,21 +11,16 @@
# limitations under the License. # limitations under the License.
--- ---
- name: redhat | ensuring apache packages are present - name: ensure apache packages are present
become: yes become: yes
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' vars:
yum: - packages:
name: Debian:
- httpd
update_cache: yes
state: present
- name: ubuntu | ensuring apache packages are present
become: yes
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
apt:
name:
- apache2 - apache2
RedHat:
- httpd
package:
name: "{{ packages[ansible_os_family] }}"
update_cache: yes update_cache: yes
state: present state: present

View File

@ -14,7 +14,7 @@
become: yes become: yes
block: block:
- name: Ensure needed packages - name: Ensure needed packages
apt: package:
name: name:
- python3-passlib - python3-passlib
- python3-openssl - python3-openssl

View File

@ -24,11 +24,18 @@
name: apache-server name: apache-server
- name: Install needed packages - name: Install needed packages
apt: vars:
name: - packages:
- python3-pip Debian:
- python3-setuptools - python3-pip
- libapache2-mod-wsgi-py3 - python3-setuptools
- libapache2-mod-wsgi-py3
RedHat:
- python3-pip
- python3-setuptools
- python3-mod_wsgi
package:
name: "{{ packages[ansible_os_family] }}"
state: present state: present
- name: Install sushy-tools - name: Install sushy-tools

View File

@ -13,18 +13,7 @@
--- ---
- name: Ensuring docker and support packages are present - name: Ensuring docker and support packages are present
become: yes become: yes
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' package:
yum:
name:
- docker.io
- runc
update_cache: yes
state: present
- name: Ensuring docker and support packages are present
become: yes
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
apt:
name: name:
- docker.io - docker.io
- runc - runc

View File

@ -14,28 +14,25 @@
- block: - block:
- name: Ensuring Libvirt, Qemu and support packages are present - name: Ensuring Libvirt, Qemu and support packages are present
become: yes become: yes
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' vars:
yum: - packages:
name: Debian:
- libguestfs-tools - qemu
- libvirt - libvirt-bin
- libvirt-devel - libguestfs-tools
- libvirt-daemon-kvm - qemu-kvm
- qemu-kvm - python3-lxml
state: present - python3-libvirt
- name: Ensuring Libvirt, Qemu and support packages are present - dnsmasq
become: yes - ebtables
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' RedHat:
apt: - libguestfs-tools
name: - libvirt
- qemu - libvirt-devel
- libvirt-bin - libvirt-daemon-kvm
- libguestfs-tools - qemu-kvm
- qemu-kvm package:
- python3-lxml name: "{{ packages[ansible_os_family] }}"
- python3-libvirt
- dnsmasq
- ebtables
state: present state: present
- name: Add user "{{ ansible_user }}" to libvirt group - name: Add user "{{ ansible_user }}" to libvirt group
become: yes become: yes

View File

@ -25,7 +25,7 @@
vars: vars:
network_action: "{{ libvirt_network.network_action }}" network_action: "{{ libvirt_network.network_action }}"
- name: install required packages - name: install required packages
apt: package:
name: name:
- bridge-utils - bridge-utils
state: present state: present