From 2a21711f04b9e84c909cb490b47a587f8c2a15ea Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Tue, 26 Jun 2018 09:56:10 +0100 Subject: [PATCH] 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 --- multi-node-aio/playbooks/deploy-acng.yml | 9 +++++++-- multi-node-aio/playbooks/deploy-dhcp.yml | 7 +++++-- multi-node-aio/playbooks/deploy-pxe.yml | 7 +++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/multi-node-aio/playbooks/deploy-acng.yml b/multi-node-aio/playbooks/deploy-acng.yml index 7e206535..869b8b79 100644 --- a/multi-node-aio/playbooks/deploy-acng.yml +++ b/multi-node-aio/playbooks/deploy-acng.yml @@ -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: diff --git a/multi-node-aio/playbooks/deploy-dhcp.yml b/multi-node-aio/playbooks/deploy-dhcp.yml index 18d886e2..3eec71de 100644 --- a/multi-node-aio/playbooks/deploy-dhcp.yml +++ b/multi-node-aio/playbooks/deploy-dhcp.yml @@ -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: diff --git a/multi-node-aio/playbooks/deploy-pxe.yml b/multi-node-aio/playbooks/deploy-pxe.yml index 0058e75e..2980aa83 100644 --- a/multi-node-aio/playbooks/deploy-pxe.yml +++ b/multi-node-aio/playbooks/deploy-pxe.yml @@ -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: