check_prerequisites.yml 1.9 KB

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