pre_requisite.yml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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: Verify the ansible and python versions installed
  16. fail:
  17. msg: "{{ ansible_python_version_status }}"
  18. when: ansible_python_version != python_version_support
  19. tags: install
  20. - name: Verify whether ansible configuration file exists
  21. stat:
  22. path: "{{ default_ansible_config_file_path }}"
  23. register: file_exists
  24. - name: Set omnia.log file
  25. replace:
  26. path: "{{ default_ansible_config_file_path }}"
  27. regexp: '#log_path = /var/log/ansible.log'
  28. replace: 'log_path = /var/log/omnia.log'
  29. when: file_exists.stat.exists
  30. tags: install
  31. - name: Check OS support
  32. assert:
  33. that:
  34. - ( ansible_distribution | lower == os_supported_centos ) and ( ansible_distribution_version >= os_supported_centos_version ) or
  35. ( ansible_distribution | lower == os_supported_rocky ) and ( ansible_distribution_version >= os_supported_rocky_version )
  36. fail_msg: "{{ fail_os_status }}"
  37. success_msg: "{{ success_os_status }}"
  38. register: os_value
  39. tags: install
  40. - name: Fetch SElinux mode
  41. command: sestatus
  42. register: sestatus_current
  43. changed_when: false
  44. - name: Disable SElinux
  45. replace:
  46. path: /etc/sysconfig/selinux
  47. regexp: 'SELINUX=[a-z]+'
  48. replace: 'SELINUX=disabled'
  49. when: '"SELinux status: enabled" in sestatus_current.stdout_lines'
  50. tags: install
  51. - name: Status of SElinux
  52. fail:
  53. msg: "{{ selinux_status }}"
  54. when: '"SELinux status: enabled" in sestatus_current.stdout_lines'
  55. register: selinux_value
  56. tags: install
  57. - name: State of firewall
  58. service:
  59. name: firewalld
  60. state: started
  61. enabled: yes