Cater for empty host package lists

The host package lists provided may be empty, as provided
in the defaults. When this is the case, the task should be
skipped to prevent errors.
This commit is contained in:
Jesse Pretorius 2018-03-23 12:06:41 +00:00
parent d5a9f025b8
commit c3e210e9e7
1 changed files with 2 additions and 0 deletions

View File

@ -19,6 +19,7 @@
state: "{{ distro_package_state }}"
update_cache: "{{ (ansible_pkg_mgr in ['apt', 'zypper']) | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(distro_cache_valid_time, omit) }}"
when: distro_package_list | length > 0
register: _install_distro_packages
until: _install_distro_packages | success
retries: 5
@ -29,6 +30,7 @@
name: "{{ host_pip_packages }}"
state: latest
extra_args: "{{ host_pip_install_args }}"
when: host_pip_packages | length > 0
register: _install_host_pip_packages
until: _install_host_pip_packages | success
retries: 5