check_prerequisites.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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: Initialize freeipa_status
  16. set_fact:
  17. freeipa_status: false
  18. - name: Fetch hostname
  19. command: hostname
  20. register: new_serv_hostname
  21. changed_when: false
  22. - name: Set fact for server hostname
  23. set_fact:
  24. server_hostname_ms: "{{ new_serv_hostname.stdout }}"
  25. - name: Check freeipa ui accessible or not
  26. uri:
  27. url: "https://{{ server_hostname_ms }}"
  28. status_code: "{{ return_status }}"
  29. return_content: true
  30. register: freeipa_ui_status
  31. failed_when: false
  32. - name: Check freeipa admin authentication
  33. shell: set -o pipefail && echo $'{{ ms_kerberos_admin_password }}' | kinit {{ ms_ipa_admin_username }}
  34. register: freeipa_authentication
  35. no_log: true
  36. changed_when: false
  37. failed_when: false
  38. - name: Modify freeipa_status
  39. set_fact:
  40. freeipa_status: true
  41. when:
  42. - freeipa_authentication.rc == 0
  43. - freeipa_ui_status.status == return_status