--- - name: Delete old deployment for before installing during upgrade k8s: kind: Deployment api_version: apps/v1 namespace: "{{ ansible_operator_meta.namespace }}" name: "{{ ansible_operator_meta.name }}" state: absent - name: Patching labels to AWX kind k8s: state: present definition: apiVersion: '{{ api_version }}' kind: '{{ kind }}' name: '{{ ansible_operator_meta.name }}' namespace: '{{ ansible_operator_meta.namespace }}' metadata: name: '{{ ansible_operator_meta.name }}' namespace: '{{ ansible_operator_meta.namespace }}' labels: '{{ lookup("template", "../common/templates/labels/common.yaml.j2") | from_yaml }}' when: set_self_labels | bool - name: Build `additional_labels_items` labels from `additional_labels` block: - name: Look up details for this deployment k8s_info: api_version: "{{ api_version }}" kind: "{{ kind }}" name: "{{ ansible_operator_meta.name }}" namespace: "{{ ansible_operator_meta.namespace }}" register: this_awx - name: Select resource labels which are in `additional_labels` set_fact: additional_labels_items: >- {{ this_awx['resources'][0]['metadata']['labels'] | dict2items | selectattr('key', 'in', additional_labels) | list }} when: this_awx['resources'][0]['metadata']['labels'] when: additional_labels | length - name: Include secret key configuration tasks include_tasks: secret_key_configuration.yml - name: Load LDAP CAcert certificate (Deprecated) include_tasks: load_ldap_cacert_secret.yml when: - ldap_cacert_secret != '' - name: Load ldap bind password (Deprecated) include_tasks: load_ldap_password_secret.yml when: - ldap_password_secret != '' - name: Load bundle certificate authority certificate include_tasks: load_bundle_cacert_secret.yml when: - bundle_cacert_secret != '' - name: Include admin password configuration tasks include_tasks: admin_password_configuration.yml - name: Include broadcast websocket configuration tasks include_tasks: broadcast_websocket_configuration.yml - name: Include set_images tasks include_tasks: set_images.yml - name: Include database configuration tasks include_tasks: database_configuration.yml - name: Load Route TLS certificate include_tasks: load_route_tls_secret.yml when: - ingress_type | lower == 'route' - route_tls_secret != '' - name: Wait for {{ deployment_type }}restore to complete kubernetes.core.k8s_info: api_version: "{{ api_version }}" kind: "{{ deployment_type }}restore" namespace: "{{ ansible_operator_meta.namespace }}" register: restore_status_check until: # yamllint disable-line rule:line-length - (restore_status_check.resources | length == 0) or (restore_status_check.resources | selectattr('spec.deployment_name', 'equalto', ansible_operator_meta.name) | map(attribute='status') | selectattr('restoreComplete', 'defined') | map(attribute='restoreComplete') | list | length > 0) delay: 10 retries: 8640 ignore_errors: yes changed_when: false - name: Include resources configuration tasks include_tasks: resources_configuration.yml - name: Migrate database to the latest schema include_tasks: migrate_schema.yml when: awx_web_pod_name != '' - name: Initialize Django include_tasks: initialize_django.yml when: awx_web_pod_name != '' - name: Enable optional metrics-utility include_tasks: enable_metrics_utility.yml when: _metrics_utility_enabled | default(false) | bool - name: Enable optional metrics-utility for Redhat Console include_tasks: enable_metrics_utility_console.yml when: _metrics_utility_console_enabled | default(false) | bool - name: Update status variables include_tasks: update_status.yml when: update_status | bool - name: Cleanup & Set garbage collection refs include_tasks: cleanup.yml