pre_requisite.yml 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 run tags
  16. fail:
  17. msg: "{{ invalid_tag_msg }}"
  18. when: '"init" not in ansible_run_tags'
  19. tags: [ init, network-device, pxe, awx, network-ib, idrac, monitoring, security, firmware-repo, templates ]
  20. - name: Mount Path
  21. set_fact:
  22. mount_path: "{{ role_path + '/../../..' }}"
  23. - name: Collecting ansible python version
  24. shell:
  25. cmd: ansible --version | grep "python version" | cut -d ' ' -f 6
  26. register: ansible_python_version
  27. changed_when: false
  28. - name: Saving management station os
  29. set_fact:
  30. mgmt_os: "{{ ansible_facts['distribution'] | lower }}"
  31. - name: Verify the ansible and python versions installed
  32. fail:
  33. msg: "{{ ansible_python_version_status }}"
  34. when:
  35. - ansible_python_version.stdout != python_version_leap
  36. - ansible_python_version.stdout != python_version_support
  37. - name: Verify whether ansible configuration file exists
  38. stat:
  39. path: "{{ default_ansible_config_file_path }}"
  40. register: file_exists
  41. - name: Set omnia.log file
  42. replace:
  43. path: "{{ default_ansible_config_file_path }}"
  44. regexp: '#log_path = /var/log/ansible.log'
  45. replace: 'log_path = /var/log/omnia.log'
  46. when: file_exists.stat.exists
  47. - name: Check OS support
  48. assert:
  49. that:
  50. - ( mgmt_os == os_supported_centos ) and ( ansible_distribution_version >= os_supported_centos_version ) or
  51. ( mgmt_os == os_supported_rocky ) and ( ansible_distribution_version >= os_supported_rocky_version ) or
  52. ( os_supported_leap in mgmt_os ) and ( ansible_distribution_version >= os_supported_leap_version )
  53. fail_msg: "{{ fail_os_status }}"
  54. success_msg: "{{ success_os_status }}"
  55. register: os_value
  56. - block:
  57. - name: Fetch SElinux mode
  58. command: sestatus
  59. register: sestatus_current
  60. changed_when: false
  61. - name: Disable SElinux
  62. replace:
  63. path: /etc/sysconfig/selinux
  64. regexp: 'SELINUX=[a-z]+'
  65. replace: 'SELINUX=disabled'
  66. when: '"SELinux status: enabled" in sestatus_current.stdout_lines'
  67. - name: Status of SElinux
  68. fail:
  69. msg: "{{ selinux_status }}"
  70. when: '"SELinux status: enabled" in sestatus_current.stdout_lines'
  71. register: selinux_value
  72. when:
  73. - ( mgmt_os == os_supported_centos ) and ( ansible_distribution_version >= os_supported_centos_version ) or
  74. ( mgmt_os == os_supported_rocky ) and ( ansible_distribution_version >= os_supported_rocky_version )
  75. - name: State of firewall
  76. service:
  77. name: firewalld
  78. state: started
  79. enabled: yes