Allow bindep role to read from more then one bindep file

Extend bindep role to be able to install packages from
multiple paths at once. This behavior is fully compatible
with current implementation, however it allows to pass
number of bindep file paths.

Change-Id: I70d42f25837ff282aad534f9ead965d12858ac9b
This commit is contained in:
Michal 2020-10-27 14:43:13 +01:00
parent 856866fdde
commit 522a78385a
3 changed files with 12 additions and 5 deletions

View File

@ -19,7 +19,7 @@ then install the missing packages.
.. zuul:rolevar:: bindep_file
Path to a specific bindep file to read from.
Path or list of paths to a specific bindep file(s) to read from.
.. zuul:rolevar:: bindep_command

View File

@ -10,10 +10,13 @@
- bindep_file is defined
- bindep_command is not defined
- name: Define bindep_run fact
- name: Convert bindep_file to list
set_fact:
bindep_run: "{{ bindep_command }} -b -f {{ bindep_file }} {{ bindep_profile }}"
when: bindep_file is defined
bindep_file: "{{ [bindep_file] }}"
when: bindep_file is defined and bindep_file is string
- include_tasks: packages.yaml
loop: "{{ bindep_file }}"
loop_control:
loop_var: zj_bindep_file
when: bindep_file is defined

View File

@ -1,3 +1,7 @@
- name: Define bindep_run fact
set_fact:
bindep_run: "{{ bindep_command }} -b -f {{ zj_bindep_file }} {{ bindep_profile }}"
- name: Get list of packages to install from bindep
command: "{{ bindep_run }}"
register: bindep_output
@ -21,5 +25,5 @@
- name: Fail if we cannot install all packages
fail:
msg: "bindep failed to install from {{ bindep_file }} - {{ bindep_final_check.stdout }}"
msg: "bindep failed to install from {{ zj_bindep_file }} - {{ bindep_final_check.stdout }}"
when: bindep_final_check is failed