main.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. # Tasks for Deploying AWX on the system
  16. - name: Check AWX status on machine
  17. include_tasks: check_awx_status.yml
  18. tags: install
  19. - name: Include common variables
  20. include_vars: ../../common/vars/main.yml
  21. tags: install
  22. - name: Internet validation
  23. include_tasks: ../../common/tasks/internet_validation.yml
  24. when: not awx_status
  25. tags: install
  26. - name: Get and encrypt AWX password
  27. include_tasks: clone_awx.yml
  28. when: not awx_status
  29. tags: install
  30. - name: Modify firewall config
  31. include_tasks: firewall_settings.yml
  32. when: not awx_status
  33. tags: install
  34. - name: Install AWX
  35. include_tasks: install_awx.yml
  36. when: not awx_status
  37. tags: install
  38. - name: Status message
  39. block:
  40. - debug:
  41. msg: "{{ message_skipped }}"
  42. verbosity: 2
  43. when: awx_status
  44. - debug:
  45. msg: "{{ message_installed }}"
  46. verbosity: 2
  47. when: not awx_status
  48. tags: install
  49. - name: Internet validation
  50. include_tasks: ../../common/tasks/internet_validation.yml
  51. tags: install
  52. - name: Waiting for AWX UI to be accessible
  53. wait_for:
  54. timeout: 300
  55. delegate_to: localhost
  56. tags: install
  57. - name: Re-install if in migrating state
  58. block:
  59. - name: Check if AWX UI is accessible
  60. command: >-
  61. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ admin_password }}"
  62. organizations list -f human
  63. changed_when: no
  64. rescue:
  65. - name: Remove old containers
  66. docker_container:
  67. name: "{{ item }}"
  68. state: absent
  69. loop:
  70. - awx_task
  71. - awx_web
  72. - name: Restart docker
  73. service:
  74. name: docker
  75. state: restarted
  76. - name: Run AWX install.yml file
  77. command: ansible-playbook -i inventory install.yml --extra-vars "admin_password={{ admin_password }}"
  78. args:
  79. chdir: "{{ awx_installer_path }}"
  80. ignore_errors: yes
  81. - name: Waiting for AWX UI to be accessible
  82. wait_for:
  83. timeout: 150
  84. delegate_to: localhost
  85. tags: install
  86. - name: Install AWX-CLI
  87. include_tasks: install_awx_cli.yml
  88. tags: install
  89. - name: Configure AWX
  90. include_tasks: awx_configuration.yml
  91. tags: install