pre_requisite.yml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. - name: State of firewall
  74. service:
  75. name: firewalld
  76. state: started
  77. enabled: yes
  78. tags: init