pre_requisite.yml 2.9 KB

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