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
tasks:
- name: Install python setuptools
apt:
package:
name:
- python3-pip
- python3-setuptools

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,18 +13,7 @@
---
- name: Ensuring docker and support packages are present
become: yes
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux'
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:
package:
name:
- docker.io
- runc

View File

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

View File

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