MNAIO: Use package module properly

To improve the chances of success during builds, retries
are added to the package install tasks. Also, given that
we're using Ansible > 2.1.x, we forgo the with_items loop
for the package installs and just give the package module
the list so that it installs them all at once. Finally,
we ensure that the 'name' argument is used for all package
lists rather than the 'pkg' argument which is for apt only.

Change-Id: I5f27ea0b05c70f6c5396bd41dfe3cce54579ccb3
This commit is contained in:
Jesse Pretorius 2018-06-26 09:56:10 +01:00
parent 7bc4f939a4
commit 2a21711f04
3 changed files with 17 additions and 6 deletions

View File

@ -30,9 +30,14 @@
tasks:
- name: Install repo caching server packages
package:
name: "{{ item }}"
name: "{{ mnaio_pkg_cache_server_distro_packages }}"
state: "latest"
with_items: "{{ mnaio_pkg_cache_server_distro_packages }}"
update_cache: yes
cache_valid_time: 600
register: _install_host_packages
until: _install_host_packages | success
retries: 3
delay: 15
- name: Create cache directory
file:

View File

@ -28,11 +28,14 @@
- name: Install all required packages for dhcpd_install
package:
pkg: "{{ item }}"
name: "{{ mnaio_dhcp_distro_packages }}"
state: "latest"
update_cache: yes
cache_valid_time: 600
with_items: "{{ mnaio_dhcp_distro_packages }}"
register: _install_host_packages
until: _install_host_packages | success
retries: 3
delay: 15
- name: Enable services
service:

View File

@ -30,11 +30,14 @@
- name: Install host distro packages
package:
pkg: "{{ item }}"
name: "{{ mnaio_pxe_distro_packages }}"
state: "latest"
update_cache: yes
cache_valid_time: 600
with_items: "{{ mnaio_pxe_distro_packages }}"
register: _install_host_packages
until: _install_host_packages | success
retries: 3
delay: 15
- name: Create base directories
file: