ansible playbook: use the 'package' module

Use the 'package' module instead of the 'yum' or 'dnf' module to ensure
that packages are installed, and merge the lists of packages for RHEL,
CentOS, and Fedora, since they're all exactly the same.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
Nalin Dahyabhai 2017-09-18 10:37:22 -04:00
parent 5e3c53c172
commit 0e699415f6

View file

@ -8,22 +8,21 @@
cni_commit: dcf7368eeab15e2affc6256f0bb1e84dd46a34de cni_commit: dcf7368eeab15e2affc6256f0bb1e84dd46a34de
tasks: tasks:
- name: Update all packages - name: Update all packages
yum: package:
name: '*' name: '*'
state: latest state: latest
async: 600 async: 600
poll: 10 poll: 10
when: (ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS') when: (ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS')
ignore_errors: true ignore_errors: true
- name: Update all packages on Fedora - name: Update all packages
dnf: package:
name: '*' name: '*'
state: latest state: latest
async: 600 async: 600
poll: 10 poll: 10
when: ansible_distribution == 'Fedora' - name: Make sure we have all required packages on Fedora and its downstreams
- name: Make sure we have all required packages package:
yum:
name: "{{ item }}" name: "{{ item }}"
state: latest state: latest
with_items: with_items:
@ -52,38 +51,7 @@
- socat - socat
async: 600 async: 600
poll: 10 poll: 10
when: (ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS') when: (ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS' or ansible_distribution == 'Fedora')
- name: Make sure we have all required packages on Fedora
dnf:
name: "{{ item }}"
state: latest
with_items:
- wget
- git
- make
- gcc
- tar
- libseccomp-devel
- golang
- glib2-devel
- glibc-static
- container-selinux
- btrfs-progs-devel
- device-mapper-devel
- ostree-devel
- glibc-devel
- gpgme-devel
- libassuan-devel
- libgpg-error-devel
- pkgconfig
- skopeo-containers
- oci-systemd-hook
- oci-register-machine
- oci-umount
- socat
async: 600
poll: 10
when: ansible_distribution == 'Fedora'
- name: Setup swap to prevent kernel firing off the OOM killer - name: Setup swap to prevent kernel firing off the OOM killer
shell: | shell: |
truncate -s 8G /root/swap && \ truncate -s 8G /root/swap && \