configure_settings.yml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # Copyright 2021 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. # Get Current AWX configuration
  16. - name: Get awx-service Cluster-IP
  17. command: "kubectl get svc awx-service -n {{ awx_namespace }} -o jsonpath='{.spec.clusterIP}'"
  18. register: awx_cluster_ip
  19. changed_when: false
  20. - name: Get AWX admin password
  21. shell: "kubectl get secret awx-admin-password -n {{ awx_namespace }} -o jsonpath='{.data.password}' | base64 --decode"
  22. register: awx_admin_password
  23. changed_when: false
  24. - name: Check if config file exists
  25. stat:
  26. path: "~/.tower_cli.cfg"
  27. register: config_file_status
  28. - name: Create config file
  29. copy:
  30. dest: "~/.tower_cli.cfg"
  31. content: |
  32. [general]
  33. host: http://{{ awx_cluster_ip.stdout }}
  34. username: admin
  35. password: {{ awx_admin_password.stdout }}
  36. verify_ssl: false
  37. use_token: false
  38. owner: root
  39. mode: "{{ file_perm }}"
  40. - name: Stop and disable firewalld
  41. service:
  42. name: firewalld
  43. state: stopped
  44. enabled: no
  45. - name: Waiting for the AWX UI to be up
  46. uri:
  47. url: "http://{{ awx_cluster_ip.stdout }}"
  48. status_code: "{{ return_status }}"
  49. register: display
  50. until: display.status == 200
  51. retries: 20
  52. delay: 15
  53. changed_when: false
  54. - name: Waiting for the AWX UI to be in running state
  55. uri:
  56. url: "http://{{ awx_cluster_ip.stdout }}"
  57. status_code: "{{ return_status }}"
  58. return_content: true
  59. register: display
  60. until: awx_ui_msg not in display.content
  61. retries: 20
  62. delay: 15
  63. changed_when: false