From c2f0c214ebd16cb5b8eb8b283096e192719364c8 Mon Sep 17 00:00:00 2001 From: Hao Liu Date: Thu, 2 Mar 2023 15:11:09 -0500 Subject: [PATCH] rename tower_pod to awx_task_pod --- roles/installer/tasks/initialize_django.yml | 16 ++++++++-------- roles/installer/tasks/install.yml | 4 ++-- .../installer/tasks/resources_configuration.yml | 14 +++++++------- roles/installer/tasks/update_status.yml | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/roles/installer/tasks/initialize_django.yml b/roles/installer/tasks/initialize_django.yml index bc75a06a..158a7757 100644 --- a/roles/installer/tasks/initialize_django.yml +++ b/roles/installer/tasks/initialize_django.yml @@ -2,7 +2,7 @@ - name: Check if there are any super users defined. k8s_exec: namespace: "{{ ansible_operator_meta.namespace }}" - pod: "{{ tower_pod_name }}" + pod: "{{ awx_task_pod_name }}" container: "{{ ansible_operator_meta.name }}-task" command: >- bash -c "echo 'from django.contrib.auth.models import User; @@ -16,7 +16,7 @@ - name: Create super user via Django if it doesn't exist. k8s_exec: namespace: "{{ ansible_operator_meta.namespace }}" - pod: "{{ tower_pod_name }}" + pod: "{{ awx_task_pod_name }}" container: "{{ ansible_operator_meta.name }}-task" command: awx-manage createsuperuser --username={{ admin_user | quote }} --email={{ admin_email | quote }} --noinput register: result @@ -28,7 +28,7 @@ - name: Update Django super user password k8s_exec: namespace: "{{ ansible_operator_meta.namespace }}" - pod: "{{ tower_pod_name }}" + pod: "{{ awx_task_pod_name }}" container: "{{ ansible_operator_meta.name }}-task" command: awx-manage update_password --username='{{ admin_user }}' --password='{{ admin_password }}' register: result @@ -39,7 +39,7 @@ - name: Check if legacy queue is present k8s_exec: namespace: "{{ ansible_operator_meta.namespace }}" - pod: "{{ tower_pod_name }}" + pod: "{{ awx_task_pod_name }}" container: "{{ ansible_operator_meta.name }}-task" command: >- bash -c "awx-manage list_instances | grep '^\[tower capacity=[0-9]*\]'" @@ -50,7 +50,7 @@ - name: Unregister legacy queue k8s_exec: namespace: "{{ ansible_operator_meta.namespace }}" - pod: "{{ tower_pod_name }}" + pod: "{{ awx_task_pod_name }}" container: "{{ ansible_operator_meta.name }}-task" command: >- bash -c "awx-manage unregister_queue --queuename=tower" @@ -74,7 +74,7 @@ - name: Register default execution environments (without authentication) k8s_exec: namespace: "{{ ansible_operator_meta.namespace }}" - pod: "{{ tower_pod_name }}" + pod: "{{ awx_task_pod_name }}" container: "{{ ansible_operator_meta.name }}-task" command: >- bash -c "awx-manage register_default_execution_environments" @@ -95,7 +95,7 @@ - name: Register default execution environments (with authentication) k8s_exec: namespace: "{{ ansible_operator_meta.namespace }}" - pod: "{{ tower_pod_name }}" + pod: "{{ awx_task_pod_name }}" container: "{{ ansible_operator_meta.name }}-task" command: >- bash -c "awx-manage register_default_execution_environments @@ -111,7 +111,7 @@ - name: Create preload data if necessary. # noqa 305 k8s_exec: namespace: "{{ ansible_operator_meta.namespace }}" - pod: "{{ tower_pod_name }}" + pod: "{{ awx_task_pod_name }}" container: "{{ ansible_operator_meta.name }}-task" command: >- bash -c "awx-manage create_preload_data" diff --git a/roles/installer/tasks/install.yml b/roles/installer/tasks/install.yml index 91aed4c0..ecf945d5 100644 --- a/roles/installer/tasks/install.yml +++ b/roles/installer/tasks/install.yml @@ -83,7 +83,7 @@ - name: Check for pending migrations k8s_exec: namespace: "{{ ansible_operator_meta.namespace }}" - pod: "{{ tower_pod_name }}" + pod: "{{ awx_task_pod_name }}" container: "{{ ansible_operator_meta.name }}-task" command: >- bash -c "awx-manage showmigrations | grep -v '[X]' | grep '[ ]' | wc -l" @@ -93,7 +93,7 @@ - name: Migrate the database if the K8s resources were updated. # noqa 305 k8s_exec: namespace: "{{ ansible_operator_meta.namespace }}" - pod: "{{ tower_pod_name }}" + pod: "{{ awx_task_pod_name }}" container: "{{ ansible_operator_meta.name }}-task" command: >- bash -c "awx-manage migrate --noinput" diff --git a/roles/installer/tasks/resources_configuration.yml b/roles/installer/tasks/resources_configuration.yml index 8981b5d0..d385891f 100644 --- a/roles/installer/tasks/resources_configuration.yml +++ b/roles/installer/tasks/resources_configuration.yml @@ -14,15 +14,15 @@ - name: Set the resource pod as a variable. set_fact: - tower_pod: >- - {{ tower_pod['resources'] + awx_task_pod: >- + {{ awx_task_pod['resources'] | rejectattr('metadata.deletionTimestamp', 'defined') | sort(attribute='metadata.creationTimestamp') | first | default({}) }} - name: Set the resource pod name as a variable. set_fact: - tower_pod_name: "{{ tower_pod['metadata']['name'] | default('') }}" + awx_task_pod_name: "{{ awx_task_pod['metadata']['name'] | default('') }}" - name: Set user provided control plane ee image set_fact: @@ -252,8 +252,8 @@ wait: yes wait_timeout: "{{ (120 * replicas) or 120 }}" loop: - - web - task + - web register: this_deployment_result - block: @@ -271,7 +271,7 @@ - name: Update new resource pod as a variable. set_fact: - tower_pod: >- + awx_task_pod: >- {{ _new_pod['resources'] | rejectattr('metadata.deletionTimestamp', 'defined') | sort(attribute='metadata.creationTimestamp') @@ -279,11 +279,11 @@ - name: Update new resource pod name as a variable. set_fact: - tower_pod_name: '{{ tower_pod["metadata"]["name"] | default("")}}' + awx_task_pod_name: '{{ awx_task_pod["metadata"]["name"] | default("")}}' when: - this_deployment_result.changed - name: Verify the resource pod name is populated. assert: - that: tower_pod_name != '' + that: awx_task_pod_name != '' fail_msg: "Could not find the tower pod's name." diff --git a/roles/installer/tasks/update_status.yml b/roles/installer/tasks/update_status.yml index f557f1f4..e6641e77 100644 --- a/roles/installer/tasks/update_status.yml +++ b/roles/installer/tasks/update_status.yml @@ -47,7 +47,7 @@ - name: Retrieve instance version k8s_exec: namespace: "{{ ansible_operator_meta.namespace }}" - pod: "{{ tower_pod_name }}" + pod: "{{ awx_task_pod_name }}" container: "{{ ansible_operator_meta.name }}-task" command: >- bash -c "awx-manage --version"