diff --git a/roles/bindep/README.rst b/roles/bindep/README.rst index 5f28344a5..1acd71341 100644 --- a/roles/bindep/README.rst +++ b/roles/bindep/README.rst @@ -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 diff --git a/roles/bindep/tasks/main.yaml b/roles/bindep/tasks/main.yaml index da87414e8..b4d1472fa 100644 --- a/roles/bindep/tasks/main.yaml +++ b/roles/bindep/tasks/main.yaml @@ -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 diff --git a/roles/bindep/tasks/packages.yaml b/roles/bindep/tasks/packages.yaml index 73fd80d9a..2baba396f 100644 --- a/roles/bindep/tasks/packages.yaml +++ b/roles/bindep/tasks/packages.yaml @@ -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