--- - name: load vars include_vars: "{{ ansible_distribution }}_{{ ansible_distribution_major_version }}.yml" when: extra_packages is not defined - name: "Clear yum cache" command: yum clean all become: true become_user: root when: ansible_os_family == 'RedHat' changed_when: false - name: "Clear yum pending transactions" command: yum-complete-transaction --cleanup-only become: true become_user: root register: yumCompleteTransactioncall when: ansible_os_family == 'RedHat' changed_when: '"No unfinished transactions left." not in yumCompleteTransactioncall.stdout' - name: "Install extra packages" yum: "name={{ item }} exclude={{ excludes|join(',') }} update_cache=yes state=present" with_items: "{{ extra_packages }}" become: true become_user: root when: - '"CentOS" in ansible_distribution' register: result - name: "Install extra packages" yum: "name={{ item }} exclude={{ excludes|join(',') }} update_cache=yes state=present enablerepo='Monash_University_EPEL7_EPEL_7_-_x86_64'" with_items: "{{ extra_packages }}" become: true become_user: root when: - '"DGX" in ansible_product_name' - '"RedHat" in ansible_distribution' register: result - name: "Install extra packages with the epel repo enabled" yum: "name={{ item }} exclude={{ excludes|join(',') }} update_cache=yes state=present enablerepo=epel" with_items: "{{ extra_packages }}" become: true become_user: root when: ansible_os_family == 'RedHat' register: result - name: "Install extra packages from epel only" yum: "name={{ item }} update_cache=yes state=present enablerepo=epel" # exclude={{ excludes|join(',') }} with_items: "{{ extra_packages_epel }}" become: true become_user: root when: ansible_os_family == 'RedHat' - name: "Show yum install output" debug: msg: "{{ result.results }}" - name: "Install extra packages" apt: "name={{ item }} update_cache=yes state=present" with_items: "{{ extra_packages }}" become: true become_user: root when: ansible_os_family == 'Debian'