pre-requisites.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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: Check existence of awx and grafana on management station
  16. block:
  17. - name: Check AWX instance
  18. command: awx --version
  19. changed_when: false
  20. - name: Check grafana service
  21. command: kubectl get svc -n grafana
  22. register: grafana_svc_register
  23. failed_when: "'grafana' not in grafana_svc_register.stdout"
  24. changed_when: false
  25. rescue:
  26. - name: AWX and grafana needs to be installed
  27. fail:
  28. msg: "{{ control_plane_installation_required }}"
  29. - name: Saving management station os
  30. set_fact:
  31. mgmt_os: "{{ ansible_facts['distribution'] | lower }}"
  32. - block:
  33. - name: Fetch SElinux mode
  34. command: sestatus
  35. register: sestatus_current
  36. changed_when: false
  37. - name: Check SELinux status
  38. debug:
  39. msg: "{{ selinux_warning }}"
  40. when: '"SELinux status: disabled" in sestatus_current.stdout_lines'
  41. - name: Set SElinux to permissive mode
  42. command: setenforce 0
  43. when: '"SELinux status: enabled" in sestatus_current.stdout_lines'
  44. when: os_supported_leap not in mgmt_os
  45. - name: Check that the telemetry_base_vars.yml exists
  46. stat:
  47. path: "{{ base_vars_file }}"
  48. register: stat_result
  49. - name: Fail if telemetry_base_vars.yml file doesn't exist
  50. fail:
  51. msg: "{{ fail_msg_base_vars }}"
  52. when: not stat_result.stat.exists
  53. - name: Check that telemetry_login_vars.yml exists
  54. stat:
  55. path: "{{ login_vars_file }}"
  56. register: stat_result
  57. - name: Fail if telemetry_login_vars.yml file doesn't exist
  58. fail:
  59. msg: "{{ fail_msg_login_vars }}"
  60. when: not stat_result.stat.exists
  61. - name: Check that control_plane/login_vars.yml exists
  62. stat:
  63. path: "{{ ctrl_plane_login_vars_filename }}"
  64. register: stat_result
  65. - name: Fail if control_plane/login_vars.yml file doesn't exist
  66. fail:
  67. msg: "{{ ctrl_plane_fail_msg_login_vars }}"
  68. when: not stat_result.stat.exists
  69. - name: Install openshift using pip3
  70. pip:
  71. name: "{{ item }}"
  72. state: present
  73. executable: pip3
  74. with_items: "{{ pip_packages }}"
  75. - name: Install sqldb collection
  76. command: ansible-galaxy collection install "{{ mysqldb_collection_name }}"
  77. changed_when: false