pre_requisite.yml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # Copyright 2022 Dell Inc. or its subsidiaries. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. ---
  15. - name: Validate skip tags
  16. fail:
  17. msg: "{{ invalid_skip_tag_msg }}"
  18. tags: [ network-device, pxe, awx, network-ib, idrac, monitoring, security, firmware-repo, templates ]
  19. when:
  20. - '"init" in ansible_skip_tags'
  21. - name: Validate run tags
  22. fail:
  23. msg: "{{ invalid_run_tag_msg }}"
  24. when:
  25. - '"init" not in ansible_run_tags'
  26. - '"all" not in ansible_run_tags'
  27. tags: [ init, network-device, pxe, awx, network-ib, idrac, monitoring, security, firmware-repo, templates ]
  28. - name: Mount Path
  29. set_fact:
  30. mount_path: "{{ role_path + '/../../..' }}"
  31. tags: init
  32. - name: Saving management station os
  33. set_fact:
  34. mgmt_os: "{{ ansible_facts['distribution'] | lower }}"
  35. tags: init
  36. - name: Verify the ansible and python versions installed
  37. fail:
  38. msg: "{{ ansible_python_version_status }}"
  39. tags: init
  40. when:
  41. - ansible_python_version < python_version_support
  42. - os_supported_leap not in mgmt_os
  43. - name: Verify the ansible and python versions installed
  44. fail:
  45. msg: "{{ ansible_python_version_status }}"
  46. tags: init
  47. when:
  48. - ansible_python_version < python_version_leap
  49. - os_supported_leap in mgmt_os
  50. - ansible_distribution_version >= os_supported_leap_version
  51. - name: Verify whether ansible configuration file exists
  52. stat:
  53. path: "{{ default_ansible_config_file_path }}"
  54. register: file_exists
  55. tags: init
  56. - name: Set omnia.log file
  57. replace:
  58. path: "{{ default_ansible_config_file_path }}"
  59. regexp: '#log_path = /var/log/ansible.log'
  60. replace: 'log_path = /var/log/omnia.log'
  61. when: file_exists.stat.exists
  62. tags: init
  63. - name: Check OS support
  64. assert:
  65. that:
  66. - ( os_supported_centos in mgmt_os ) and ( ansible_distribution_version >= os_supported_centos_version ) or
  67. ( os_supported_rocky in mgmt_os ) and ( ansible_distribution_version >= os_supported_rocky_version ) or
  68. ( os_supported_leap in mgmt_os ) and ( ansible_distribution_version >= os_supported_leap_version )
  69. fail_msg: "{{ fail_os_status }}"
  70. success_msg: "{{ success_os_status }}"
  71. register: os_value
  72. tags: [ init, validate ]
  73. - block:
  74. - name: Fetch SElinux mode
  75. command: sestatus
  76. register: sestatus_current
  77. changed_when: false
  78. - name: Check SELinux status
  79. debug:
  80. msg: "{{ selinux_warning }}"
  81. when: '"SELinux status: disabled" in sestatus_current.stdout_lines'
  82. - name: Set SElinux to permissive mode
  83. command: setenforce 0
  84. when: '"SELinux status: enabled" in sestatus_current.stdout_lines'
  85. tags: init
  86. when: os_supported_leap not in mgmt_os