- 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 failed_when: false changed_when: false - name: Install distro packages from bindep package: name: "{{ bindep_output.stdout_lines }}" state: present become: true when: bindep_output.stdout_lines changed_when: true - name: Check that packages are installed command: "{{ bindep_run }}" register: bindep_final_check # Ignore errors then fail later so that we can give a better error message failed_when: false changed_when: false - name: Fail if we cannot install all packages fail: msg: "bindep failed to install from {{ zj_bindep_file }} - {{ bindep_final_check.stdout }}" when: bindep_final_check is failed