install_perccli_MegaRAID.yaml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. ---
  2. - name: "Install Dell's perccli (MegaRAID) cli util"
  3. hosts: all
  4. gather_facts: yes
  5. become: true
  6. tasks:
  7. - name: Create /home/Ansible/install_packages if it does not exist.
  8. file:
  9. path: /home/Ansible/install_packages
  10. state: directory
  11. mode: '0775'
  12. owner: Ansible
  13. group: Ansible
  14. # For RHEL-like:
  15. - name: Copy the appropriate .rpm file (RH5-like) from ~/install_packages/
  16. copy:
  17. src: perccli/RH5-7/perccli-007.0318.0000.0000-1.noarch.rpm
  18. dest: /home/Ansible/install_packages/
  19. owner: Ansible
  20. mode: 0664
  21. when: (ansible_facts['os_family'] == "RedHat") and (ansible_facts['distribution_major_version'] == "5")
  22. - name: Install rpm file RH(5)-like
  23. yum:
  24. name: /home/Ansible/install_packages/perccli-007.0318.0000.0000-1.noarch.rpm
  25. # enablerepo:
  26. # disablrepo:
  27. state: present
  28. when: (ansible_facts['os_family'] == "RedHat") and (ansible_facts['distribution_major_version'] == "5")
  29. - name: Copy the appropriate .rpm file (RH6-like) from ~/install_packages/
  30. copy:
  31. src: perccli/RH5-7/perccli-007.0318.0000.0000-1.noarch.rpm
  32. dest: /home/Ansible/install_packages/
  33. owner: Ansible
  34. mode: 0664
  35. when: (ansible_facts['os_family'] == "RedHat") and (ansible_facts['distribution_major_version'] == "6")
  36. - name: Install rpm file to host if RH(6)-like
  37. yum:
  38. name: /home/Ansible/install_packages/perccli-007.0318.0000.0000-1.noarch.rpm
  39. # enablerepo:
  40. # disablerepo:
  41. state: present
  42. when: (ansible_facts['os_family'] == "RedHat") and (ansible_facts['distribution_major_version'] == "6")
  43. - name: Copy the appropriate .rpm file (RH7-like) from ~/install_packages/
  44. copy:
  45. src: perccli/RH7-8/perccli-007.1020.0000.0000-1.noarch.rpm
  46. dest: /home/Ansible/install_packages/
  47. owner: Ansible
  48. mode: 0664
  49. when: (ansible_facts['os_family'] == "RedHat") and (ansible_facts['distribution_major_version'] == "7")
  50. - name: Install rpm file to host if RH(7)-like
  51. yum:
  52. name: /home/Ansible/install_packages/perccli-007.1020.0000.0000-1.noarch.rpm
  53. state: present
  54. when: (ansible_facts['os_family'] == "RedHat") and (ansible_facts['distribution_major_version'] == "7")
  55. - name: Copy the appropriate .rpm file (RH8-like) from ~/install_packages/
  56. copy:
  57. src: perccli/RH8-9/perccli2-008.0004.0000.0022-1.x86_64.rpm
  58. dest: /home/Ansible/install_packages/
  59. owner: Ansible
  60. mode: 0664
  61. when: (ansible_facts['os_family'] == "RedHat") and (ansible_facts['distribution_major_version'] == "8")
  62. - name: Install rpm file to host if RH(8)-like
  63. yum:
  64. name: /home/Ansible/install_packages/perccli2-008.0004.0000.0022-1.x86_64.rpm
  65. state: present
  66. when: (ansible_facts['os_family'] == "RedHat") and (ansible_facts['distribution_major_version'] == "8")
  67. - name: Copy the appropriate .rpm file (RH9-like) from ~/install_packages/
  68. copy:
  69. src: perccli/RH8-9/perccli2-008.0004.0000.0022-1.x86_64.rpm
  70. dest: /home/Ansible/install_packages/
  71. owner: Ansible
  72. mode: 0664
  73. when: (ansible_facts['os_family'] == "RedHat") and (ansible_facts['distribution_major_version'] == "9")
  74. - name: Install rpm file to host if RH(9)-like
  75. yum:
  76. name: /home/Ansible/install_packages/perccli2-008.0004.0000.0022-1.x86_64.rpm
  77. state: present
  78. when: (ansible_facts['os_family'] == "RedHat") and (ansible_facts['distribution_major_version'] == "9")
  79. # For Deb-like:
  80. - name: Copy the appropriate .deb file (Ubuntu 16.04) from ~/install_packages/
  81. copy:
  82. src: perccli/Ub1604/perccli_007.0318.0000.0000-2_all.deb
  83. dest: /home/Ansible/install_packages/
  84. when: (ansible_facts['distribution'] == "Ubuntu") and (ansible_facts['distribution_major_version'] == "16")
  85. - name: Install the .deb file using apt
  86. apt:
  87. update_cache: yes
  88. deb: /home/Ansible/install_packages/perccli_007.0318.0000.0000-2_all.deb
  89. clean: yes
  90. when: (ansible_facts['distribution'] == "Ubuntu") and (ansible_facts['distribution_major_version'] == "16")
  91. - name: Copy the appropriate .deb file (Ubuntu 18.04) from ~/install_packages/
  92. copy:
  93. src: perccli/Ub1804/perccli_007.1020.0000.0000-2_all.deb
  94. dest: /home/Ansible/install_packages/
  95. when: (ansible_facts['distribution'] == "Ubuntu") and (ansible_facts['distribution_major_version'] == "18")
  96. - name: Install the .deb file using apt
  97. apt:
  98. update_cache: yes
  99. deb: /home/Ansible/install_packages/perccli_007.1020.0000.0000-2_all.deb
  100. clean: yes
  101. when: (ansible_facts['distribution'] == "Ubuntu") and (ansible_facts['distribution_major_version'] == "18")
  102. - name: Copy the appropriate .deb file (Ubuntu 20.04) from ~/install_packages/
  103. copy:
  104. src: perccli/Ub2204/perccli2_008.0004.0000.0022_all.deb
  105. dest: /home/Ansible/install_packages/
  106. owner: Ansible
  107. mode: 0664
  108. when: (ansible_facts['distribution'] == "Ubuntu") and (ansible_facts['distribution_major_version'] == "20")
  109. - name: Install deb file using apt
  110. apt:
  111. update_cache: yes
  112. deb: /home/Ansible/install_packages/perccli2_008.0004.0000.0022_all.deb
  113. force_apt_get: yes
  114. clean: yes
  115. when: (ansible_facts['distribution'] == "Ubuntu") and (ansible_facts['distribution_major_version'] == "20")
  116. - name: Copy the appropriate .deb file (Ubuntu 22.04) from ~/install_packages/
  117. copy:
  118. src: perccli/Ub2204/perccli2_008.0004.0000.0022_all.deb
  119. dest: /home/Ansible/install_packages/
  120. when: (ansible_facts['distribution'] == "Ubuntu") and (ansible_facts['distribution_major_version'] == "22")
  121. - name: Install the .deb file using apt
  122. apt:
  123. update_cache: yes
  124. deb: /home/Ansible/install_packages/perccli/Ub2204/perccli2_008.0004.0000.0022_all.deb
  125. clean: yes
  126. when: (ansible_facts['distribution'] == "Ubuntu") and (ansible_facts['distribution_major_version'] == "22")