check_prerequisites.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Copyright 2021 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: Include provision_idrac vars
  16. include_vars: "{{ playbook_dir }}/../roles/provision_idrac/vars/main.yml"
  17. run_once: true
  18. - name: Include control_plane_common vars
  19. include_vars: "{{ playbook_dir }}/../roles/control_plane_common/vars/main.yml"
  20. run_once: true
  21. - name: Include idrac_vars.yml
  22. include_vars: "{{ playbook_dir }}/../{{ idrac_input_filename }}"
  23. run_once: true
  24. - name: Check hostname
  25. command: hostname
  26. changed_when: false
  27. register: hostname
  28. run_once: true
  29. - name: Set idrac credentials
  30. set_fact:
  31. idrac_username: "{{ lookup('env','ANSIBLE_NET_USERNAME') }}"
  32. idrac_password: "{{ lookup('env','ANSIBLE_NET_PASSWORD') }}"
  33. no_log: true
  34. when: '"awx-" in hostname.stdout'
  35. run_once: true
  36. - name: Fetch idrac credentials
  37. include_tasks: "{{ playbook_dir }}/../roles/provision_idrac/tasks/fetch_idrac_credentials.yml"
  38. vars:
  39. login_input_filename: "{{ playbook_dir }}/../{{ login_vars_filename }}"
  40. login_vault_filename: "{{ playbook_dir }}/../{{ vault_filename }}"
  41. when: '"awx-" not in hostname.stdout'
  42. - name: Show status of the Lifecycle Controller
  43. dellemc.openmanage.idrac_lifecycle_controller_status_info:
  44. idrac_ip: "{{ inventory_hostname }}"
  45. idrac_user: "{{ idrac_username }}"
  46. idrac_password: "{{ idrac_password }}"
  47. register: lc_check_status
  48. - name: LC not available
  49. fail:
  50. msg: "{{ lc_check_fail_msg }}"
  51. when: not lc_check_status.lc_status_info.LCReady
  52. register: lc_fail