install_awx.yml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. no_log: True
  48. rescue:
  49. - name: Check AWX status on machine
  50. include_tasks: check_awx_status.yml
  51. - name: Fail if container are not running
  52. fail:
  53. msg: "AWX installation failed with error msg:
  54. {{ awx_installation.stdout | regex_replace(admin_password) }}."
  55. when: not awx_status
  56. tags: install