Use package module to install distro packages

Consolidate distro package install tasks into a
single task using the package module and pass
the package list into the name instead of using
a with_items loop.

Change-Id: Ia410f29e53764bebe5dbe096d441cdc78d336e64
This commit is contained in:
Jesse Pretorius 2017-05-02 09:54:00 +01:00 committed by Jesse Pretorius (odyssey4me)
parent 8a4729de24
commit 23a7eb6493

View File

@ -46,29 +46,13 @@
- openrc
post_tasks:
- name: Update apt sources
apt:
update_cache: yes
cache_valid_time: 600
register: apt_update
until: apt_update|success
retries: 5
delay: 2
when: ansible_pkg_mgr == 'apt'
- name: Install apt packages
apt:
pkg: "{{ item }}"
- name: Install distro packages
package:
name: "{{ utility_distro_packages | default([]) }}"
state: "{{ utility_package_state }}"
with_items: "{{ utility_distro_packages | default([]) }}"
when: ansible_pkg_mgr == 'apt'
- name: Install yum packages
yum:
pkg: "{{ item }}"
state: "{{ utility_package_state }}"
with_items: "{{ utility_distro_packages | default([]) }}"
when: ansible_pkg_mgr == 'yum'
update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"
- name: Get list of python clients
shell: "curl -s {{ repo_release_path }}/requirements_absolute_requirements.txt | grep client | cut -d'=' -f1"