install_awx.yml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 installing AWX
  16. - name: Change inventory file
  17. replace:
  18. path: "{{ awx_inventory_path }}"
  19. regexp: "{{ item.regexp }}"
  20. replace: "{{ item.replace }}"
  21. loop:
  22. - { name: Project data directory, regexp: "{{ project_data_dir_old }}" , replace: "{{ project_data_dir_new }}" }
  23. - { name: Alternate DNS Servers, regexp: "{{ awx_alternate_dns_servers_old }}", replace: "{{ awx_alternate_dns_servers_new }}" }
  24. - { name: Credentials, regexp: "{{ admin_password_old }}", replace: "{{ admin_password_new }}"}
  25. loop_control:
  26. label: "{{ item.name }}"
  27. tags: install
  28. - name: Ensure port is 8081
  29. lineinfile:
  30. path: "{{ awx_inventory_path }}"
  31. regexp: "{{ port_old }}"
  32. line: "{{ port_new }}"
  33. state: present
  34. - name: Create pgdocker directory
  35. file:
  36. path: "{{ pgdocker_dir_path }}"
  37. state: directory
  38. mode: 0775
  39. tags: install
  40. - name: Install AWX
  41. block:
  42. - name: Run AWX install.yml file
  43. command: ansible-playbook -i inventory install.yml --extra-vars "admin_password={{ admin_password }}"
  44. args:
  45. chdir: "{{ awx_installer_path }}"
  46. register: awx_installation
  47. rescue:
  48. - name: Check AWX status on machine
  49. include_tasks: check_awx_status.yml
  50. - name: Fail if container are not running
  51. fail:
  52. msg: "AWX installation failed."
  53. when: not awx_status
  54. tags: install