diff --git a/deploy/awx-operator.yaml b/deploy/awx-operator.yaml index 57fc0ea3..7677abe5 100644 --- a/deploy/awx-operator.yaml +++ b/deploy/awx-operator.yaml @@ -572,6 +572,7 @@ rules: - apps resources: - deployments/scale + - statefulsets/scale verbs: - patch - apiGroups: diff --git a/roles/backup/defaults/main.yml b/roles/backup/defaults/main.yml index 484b54f2..b160118f 100644 --- a/roles/backup/defaults/main.yml +++ b/roles/backup/defaults/main.yml @@ -1,6 +1,8 @@ --- # Required: specify name of tower deployment to backup from deployment_name: '' +kind: 'AWXBackup' +api_version: '{{ deployment_type }}.ansible.com/v1beta1' # Specify a pre-created PVC (name) to backup to backup_pvc: '' diff --git a/roles/backup/tasks/error_handling.yml b/roles/backup/tasks/error_handling.yml index de1c28ce..1d41721d 100644 --- a/roles/backup/tasks/error_handling.yml +++ b/roles/backup/tasks/error_handling.yml @@ -1,10 +1,5 @@ --- -- name: Set apiVersion and kind variables - set_fact: - api_version: '{{ hostvars["localhost"]["inventory_file"].split("/")[4:6] | join("/") }}' - kind: '{{ hostvars["localhost"]["inventory_file"].split("/")[6] }}' - - name: Determine the timestamp set_fact: now: '{{ lookup("pipe", "date +%FT%TZ") }}' diff --git a/roles/backup/tasks/init.yml b/roles/backup/tasks/init.yml index a0d208e6..42f593d9 100644 --- a/roles/backup/tasks/init.yml +++ b/roles/backup/tasks/init.yml @@ -60,15 +60,10 @@ template: "management-pod.yml.j2" wait: true -# Retrieve AWX object for use in postgres.yml and secrets.yml -- name: Set apiVersion and kind variables - set_fact: - api_version: '{{ hostvars["localhost"]["inventory_file"].split("/")[4:6] | join("/") }}' - - name: Look up details for this deployment k8s_info: api_version: "{{ api_version }}" - kind: "AWX" # Find a way to dynamically get this + kind: "AWX" name: "{{ deployment_name }}" namespace: "{{ meta.namespace }}" register: this_awx diff --git a/roles/backup/tasks/main.yml b/roles/backup/tasks/main.yml index f8203871..0ea4ce38 100644 --- a/roles/backup/tasks/main.yml +++ b/roles/backup/tasks/main.yml @@ -1,10 +1,5 @@ --- -- name: Set apiVersion and kind variables - set_fact: - api_version: '{{ hostvars["localhost"]["inventory_file"].split("/")[4:6] | join("/") }}' - kind: '{{ hostvars["localhost"]["inventory_file"].split("/")[6] }}' - - name: Look up details for this backup object k8s_info: api_version: "{{ api_version }}" diff --git a/roles/backup/tasks/update_status.yml b/roles/backup/tasks/update_status.yml index fe55aa92..a497e86a 100644 --- a/roles/backup/tasks/update_status.yml +++ b/roles/backup/tasks/update_status.yml @@ -1,8 +1,4 @@ --- -- name: Set apiVersion and kind variables - set_fact: - api_version: '{{ hostvars["localhost"]["inventory_file"].split("/")[4:6] | join("/") }}' - kind: '{{ hostvars["localhost"]["inventory_file"].split("/")[6] }}' # The backup directory in this status can be referenced when restoring - name: Update Tower Backup status diff --git a/roles/installer/tasks/database_configuration.yml b/roles/installer/tasks/database_configuration.yml index ef26b715..acf55554 100644 --- a/roles/installer/tasks/database_configuration.yml +++ b/roles/installer/tasks/database_configuration.yml @@ -113,12 +113,6 @@ awx_postgres_host: "{{ pg_config['resources'][0]['data']['host'] | b64decode }}" awx_postgres_sslmode: "{{ pg_config['resources'][0]['data']['sslmode'] | default('prefer'|b64encode) | b64decode }}" - -- name: Set apiVersion and kind variables - set_fact: - api_version: '{{ hostvars["localhost"]["inventory_file"].split("/")[4:6] | join("/") }}' - kind: '{{ hostvars["localhost"]["inventory_file"].split("/")[6] }}' - - name: Look up details for this deployment k8s_info: api_version: "{{ api_version }}" diff --git a/roles/restore/defaults/main.yml b/roles/restore/defaults/main.yml index af7a06f5..0a9422a9 100644 --- a/roles/restore/defaults/main.yml +++ b/roles/restore/defaults/main.yml @@ -1,6 +1,8 @@ --- # Required: specify name of tower deployment to restore to deployment_name: '' +kind: 'AWXRestore' +api_version: '{{ deployment_type }}.ansible.com/v1beta1' # Required: specify a pre-created PVC (name) to restore from backup_pvc: '' diff --git a/roles/restore/tasks/error_handling.yml b/roles/restore/tasks/error_handling.yml index de1c28ce..1d41721d 100644 --- a/roles/restore/tasks/error_handling.yml +++ b/roles/restore/tasks/error_handling.yml @@ -1,10 +1,5 @@ --- -- name: Set apiVersion and kind variables - set_fact: - api_version: '{{ hostvars["localhost"]["inventory_file"].split("/")[4:6] | join("/") }}' - kind: '{{ hostvars["localhost"]["inventory_file"].split("/")[6] }}' - - name: Determine the timestamp set_fact: now: '{{ lookup("pipe", "date +%FT%TZ") }}' diff --git a/roles/restore/tasks/main.yml b/roles/restore/tasks/main.yml index 7fda2e1c..2710b2aa 100644 --- a/roles/restore/tasks/main.yml +++ b/roles/restore/tasks/main.yml @@ -1,10 +1,5 @@ --- -- name: Set apiVersion and kind variables - set_fact: - api_version: '{{ hostvars["localhost"]["inventory_file"].split("/")[4:6] | join("/") }}' - kind: '{{ hostvars["localhost"]["inventory_file"].split("/")[6] }}' - - name: Look up details for this restore object k8s_info: api_version: "{{ api_version }}" diff --git a/roles/restore/tasks/update_status.yml b/roles/restore/tasks/update_status.yml index 92196d01..2b63a884 100644 --- a/roles/restore/tasks/update_status.yml +++ b/roles/restore/tasks/update_status.yml @@ -1,8 +1,4 @@ --- -- name: Set apiVersion and kind variables - set_fact: - api_version: '{{ hostvars["localhost"]["inventory_file"].split("/")[4:6] | join("/") }}' - kind: '{{ hostvars["localhost"]["inventory_file"].split("/")[6] }}' - name: Update Tower Restore status operator_sdk.util.k8s_status: