--- - name: "Install Dell's perccli (MegaRAID) cli util" hosts: all gather_facts: yes become: true tasks: - name: Create /home/Ansible/install_packages if it does not exist. file: path: /home/Ansible/install_packages state: directory mode: '0775' owner: Ansible group: Ansible # For RHEL-like: - name: Copy the appropriate .rpm file (RH5-like) from ~/install_packages/ copy: src: perccli/RH5-7/perccli-007.0318.0000.0000-1.noarch.rpm dest: /home/Ansible/install_packages/ owner: Ansible mode: 0664 when: (ansible_facts['os_family'] == "RedHat") and (ansible_facts['distribution_major_version'] == "5") - name: Install rpm file RH(5)-like yum: name: /home/Ansible/install_packages/perccli-007.0318.0000.0000-1.noarch.rpm # enablerepo: # disablrepo: state: present when: (ansible_facts['os_family'] == "RedHat") and (ansible_facts['distribution_major_version'] == "5") - name: Copy the appropriate .rpm file (RH6-like) from ~/install_packages/ copy: src: perccli/RH5-7/perccli-007.0318.0000.0000-1.noarch.rpm dest: /home/Ansible/install_packages/ owner: Ansible mode: 0664 when: (ansible_facts['os_family'] == "RedHat") and (ansible_facts['distribution_major_version'] == "6") - name: Install rpm file to host if RH(6)-like yum: name: /home/Ansible/install_packages/perccli-007.0318.0000.0000-1.noarch.rpm # enablerepo: # disablerepo: state: present when: (ansible_facts['os_family'] == "RedHat") and (ansible_facts['distribution_major_version'] == "6") - name: Copy the appropriate .rpm file (RH7-like) from ~/install_packages/ copy: src: perccli/RH7-8/perccli-007.1020.0000.0000-1.noarch.rpm dest: /home/Ansible/install_packages/ owner: Ansible mode: 0664 when: (ansible_facts['os_family'] == "RedHat") and (ansible_facts['distribution_major_version'] == "7") - name: Install rpm file to host if RH(7)-like yum: name: /home/Ansible/install_packages/perccli-007.1020.0000.0000-1.noarch.rpm state: present when: (ansible_facts['os_family'] == "RedHat") and (ansible_facts['distribution_major_version'] == "7") - name: Copy the appropriate .rpm file (RH8-like) from ~/install_packages/ copy: src: perccli/RH8-9/perccli2-008.0004.0000.0022-1.x86_64.rpm dest: /home/Ansible/install_packages/ owner: Ansible mode: 0664 when: (ansible_facts['os_family'] == "RedHat") and (ansible_facts['distribution_major_version'] == "8") - name: Install rpm file to host if RH(8)-like yum: name: /home/Ansible/install_packages/perccli2-008.0004.0000.0022-1.x86_64.rpm state: present when: (ansible_facts['os_family'] == "RedHat") and (ansible_facts['distribution_major_version'] == "8") - name: Copy the appropriate .rpm file (RH9-like) from ~/install_packages/ copy: src: perccli/RH8-9/perccli2-008.0004.0000.0022-1.x86_64.rpm dest: /home/Ansible/install_packages/ owner: Ansible mode: 0664 when: (ansible_facts['os_family'] == "RedHat") and (ansible_facts['distribution_major_version'] == "9") - name: Install rpm file to host if RH(9)-like yum: name: /home/Ansible/install_packages/perccli2-008.0004.0000.0022-1.x86_64.rpm state: present when: (ansible_facts['os_family'] == "RedHat") and (ansible_facts['distribution_major_version'] == "9") # For Deb-like: - name: Copy the appropriate .deb file (Ubuntu 16.04) from ~/install_packages/ copy: src: perccli/Ub1604/perccli_007.0318.0000.0000-2_all.deb dest: /home/Ansible/install_packages/ when: (ansible_facts['distribution'] == "Ubuntu") and (ansible_facts['distribution_major_version'] == "16") - name: Install the .deb file using apt apt: update_cache: yes deb: /home/Ansible/install_packages/perccli_007.0318.0000.0000-2_all.deb clean: yes when: (ansible_facts['distribution'] == "Ubuntu") and (ansible_facts['distribution_major_version'] == "16") - name: Copy the appropriate .deb file (Ubuntu 18.04) from ~/install_packages/ copy: src: perccli/Ub1804/perccli_007.1020.0000.0000-2_all.deb dest: /home/Ansible/install_packages/ when: (ansible_facts['distribution'] == "Ubuntu") and (ansible_facts['distribution_major_version'] == "18") - name: Install the .deb file using apt apt: update_cache: yes deb: /home/Ansible/install_packages/perccli_007.1020.0000.0000-2_all.deb clean: yes when: (ansible_facts['distribution'] == "Ubuntu") and (ansible_facts['distribution_major_version'] == "18") - name: Copy the appropriate .deb file (Ubuntu 20.04) from ~/install_packages/ copy: src: perccli/Ub2204/perccli2_008.0004.0000.0022_all.deb dest: /home/Ansible/install_packages/ owner: Ansible mode: 0664 when: (ansible_facts['distribution'] == "Ubuntu") and (ansible_facts['distribution_major_version'] == "20") - name: Install deb file using apt apt: update_cache: yes deb: /home/Ansible/install_packages/perccli2_008.0004.0000.0022_all.deb force_apt_get: yes clean: yes when: (ansible_facts['distribution'] == "Ubuntu") and (ansible_facts['distribution_major_version'] == "20") - name: Copy the appropriate .deb file (Ubuntu 22.04) from ~/install_packages/ copy: src: perccli/Ub2204/perccli2_008.0004.0000.0022_all.deb dest: /home/Ansible/install_packages/ when: (ansible_facts['distribution'] == "Ubuntu") and (ansible_facts['distribution_major_version'] == "22") - name: Install the .deb file using apt apt: update_cache: yes deb: /home/Ansible/install_packages/perccli/Ub2204/perccli2_008.0004.0000.0022_all.deb clean: yes when: (ansible_facts['distribution'] == "Ubuntu") and (ansible_facts['distribution_major_version'] == "22")