ui_accessibility.yml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. # Copyright 2020 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. # Check accessibility of AWX-UI
  16. - name: Re-install if in migrating state
  17. block:
  18. - name: Wait for AWX UI to be up
  19. uri:
  20. url: "{{ awx_ip }}"
  21. status_code: "{{ return_status }}"
  22. return_content: yes
  23. register: register_error
  24. until: awx_ui_msg in register_error.content
  25. retries: 20
  26. delay: 15
  27. changed_when: no
  28. no_log: True
  29. rescue:
  30. - name: Starting rescue
  31. debug:
  32. msg: "Attempting to re-install AWX"
  33. - name: Remove old containers
  34. docker_container:
  35. name: "{{ item }}"
  36. state: absent
  37. loop:
  38. - awx_task
  39. - awx_web
  40. - name: Restart docker
  41. service:
  42. name: docker
  43. state: restarted
  44. - name: Re-install AWX
  45. block:
  46. - name: Run AWX install.yml file
  47. command: ansible-playbook -i inventory install.yml --extra-vars "admin_password={{ admin_password }}"
  48. args:
  49. chdir: "{{ awx_installer_path }}"
  50. register: awx_installation
  51. no_log: True
  52. rescue:
  53. - name: Check AWX status on machine
  54. include_tasks: check_awx_status.yml
  55. - name: Fail if container are not running
  56. fail:
  57. msg: "AWX installation failed with error msg:
  58. {{ awx_installation.stdout | regex_replace(admin_password) }}."
  59. when: not awx_status
  60. - name: Check if AWX UI is up
  61. block:
  62. - name: Wait for AWX UI to be up
  63. uri:
  64. url: "{{ awx_ip }}"
  65. status_code: "{{ return_status }}"
  66. return_content: yes
  67. register: register_error
  68. until: awx_ui_msg in register_error.content
  69. retries: 240
  70. delay: 15
  71. changed_when: no
  72. no_log: True
  73. rescue:
  74. - name: Message
  75. fail:
  76. msg: "{{ register_error | regex_replace(awx_user) | regex_replace(admin_password) }}"
  77. tags: install