pre-requisites.yml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 k8s on management station
  16. block:
  17. - name: Verify that kubernetes is installed
  18. command: kubectl cluster-info
  19. register: k8s_cluster_info
  20. failed_when: "'running' not in k8s_cluster_info.stdout"
  21. changed_when: false
  22. no_log: true
  23. rescue:
  24. - name: Kubernetes needs to be installed
  25. fail:
  26. msg: "{{ k8s_installation_required }}"
  27. - name: Add kubernetes ansible-galaxy collection
  28. command: ansible-galaxy collection install kubernetes.core
  29. changed_when: false
  30. - name: Check that the base_vars.yml exists
  31. stat:
  32. path: "{{ base_vars_file }}"
  33. register: stat_result
  34. - name: Fail if base vars file doesn't exist
  35. fail:
  36. msg: "{{ fail_msg_base_vars }}"
  37. when: not stat_result.stat.exists
  38. - name: Check that the login_vars.yml exists
  39. stat:
  40. path: "{{ login_vars_file }}"
  41. register: stat_result
  42. - name: Fail if login vars file doesn't exist
  43. fail:
  44. msg: "{{ fail_msg_login_vars }}"
  45. when: not stat_result.stat.exists
  46. - name: Install openshift using pip3
  47. pip:
  48. name: openshift
  49. state: present
  50. executable: pip3