Fix small namespace issue

This commit is contained in:
Christian M. Adams
2021-04-05 17:57:12 -04:00
parent 5669747bbf
commit b9d0852c83
9 changed files with 16 additions and 15 deletions

View File

@@ -9,7 +9,7 @@
- name: Deploy AWX
k8s:
state: "{{ state | default('present') }}"
namespace: "{{ tower_namespace | default('default') }}"
namespace: "{{ namespace | default('default') }}"
apply: yes
wait: yes
definition:

View File

@@ -32,7 +32,7 @@
- name: Write awx object to pvc
community.kubernetes.k8s_exec:
namespace: "{{ meta.namespace }}"
namespace: "{{ tower_backup_pvc_namespace }}"
pod: "{{ meta.name }}-db-management"
command: >-
bash -c "echo '{{ awx_object_template }}' > {{ backup_dir }}/awx_object.yml"

View File

@@ -54,7 +54,7 @@
- name: Create management pod from templated deployment config
community.kubernetes.k8s:
name: "{{ tower_backup_pvc_namespace }}-db-management"
name: "{{ meta.name }}-db-management"
kind: Deployment
state: present
template: "management-pod.yml.j2"

View File

@@ -29,7 +29,7 @@
- include_tasks: cleanup.yml
when:
- this_backup['resources'][0]['status']['towerBackupComplete'] is not defined
- this_backup['resources'][0]['status']['towerBackupDirectory'] is not defined
- name: Update status variables
include_tasks: update_status.yml

View File

@@ -52,21 +52,21 @@
- name: Create directory for backup
community.kubernetes.k8s_exec:
namespace: "{{ meta.namespace }}"
namespace: "{{ tower_backup_pvc_namespace }}"
pod: "{{ meta.name }}-db-management"
command: >-
mkdir -p {{ backup_dir }}
- name: Precreate file for database dump
community.kubernetes.k8s_exec:
namespace: "{{ meta.namespace }}"
namespace: "{{ tower_backup_pvc_namespace }}"
pod: "{{ meta.name }}-db-management"
command: >-
touch {{ backup_dir }}/tower.db
- name: Set permissions on file for database dump
community.kubernetes.k8s_exec:
namespace: "{{ meta.namespace }}"
namespace: "{{ tower_backup_pvc_namespace }}"
pod: "{{ meta.name }}-db-management"
command: >-
chmod 0600 {{ backup_dir }}/tower.db
@@ -82,7 +82,7 @@
- name: Write pg_dump to backup on PVC
community.kubernetes.k8s_exec:
namespace: "{{ meta.namespace }}"
namespace: "{{ tower_backup_pvc_namespace }}"
pod: "{{ meta.name }}-db-management"
command: >-
bash -c "PGPASSWORD={{ awx_postgres_pass }} {{ pgdump }} > {{ backup_dir }}/tower.db"

View File

@@ -29,7 +29,7 @@
- name: Write secret_key to pvc
community.kubernetes.k8s_exec:
namespace: "{{ meta.namespace }}"
namespace: "{{ tower_backup_pvc_namespace }}"
pod: "{{ meta.name }}-db-management"
command: >-
bash -c "echo '{{ secret_key_template }}' > {{ backup_dir }}/secret_key_secret.yml"
@@ -57,7 +57,7 @@
- name: Write secret_key to pvc
community.kubernetes.k8s_exec:
namespace: "{{ meta.namespace }}"
namespace: "{{ tower_backup_pvc_namespace }}"
pod: "{{ meta.name }}-db-management"
command: >-
bash -c "echo '{{ admin_password_template }}' > {{ backup_dir }}/admin_password_secret.yml"
@@ -85,7 +85,7 @@
- name: Write broadcast_websocket definition to pvc
community.kubernetes.k8s_exec:
namespace: "{{ meta.namespace }}"
namespace: "{{ tower_backup_pvc_namespace }}"
pod: "{{ meta.name }}-db-management"
command: >-
bash -c "echo '{{ broadcast_websocket_template }}' > {{ backup_dir }}/broadcast_websocket_secret.yml"
@@ -93,7 +93,7 @@
- name: Get postgres configuration
k8s_info:
kind: Secret
namespace: '{{ meta.namespace }}'
namespace: '{{ tower_backup_pvc_namespace }}'
name: '{{ tower_postgres_configuration_secret }}'
register: _postgres_configuration
@@ -118,7 +118,7 @@
- name: Write postgres configuration to pvc
community.kubernetes.k8s_exec:
namespace: "{{ meta.namespace }}"
namespace: "{{ tower_backup_pvc_namespace }}"
pod: "{{ meta.name }}-db-management"
command: >-
bash -c "echo '{{ postgres_secret_template }}' > {{ backup_dir }}/postgres_secret.yml"

View File

@@ -1,3 +1,4 @@
---
deployment_type: "awx"
tower_postgres_image: postgres:12
tower_backup_complete: false

View File

@@ -58,4 +58,4 @@
- name: Set flag signifying that this instance has been migrated
set_fact:
tower_migrated_from_secret: "{{ awx_old_postgres_configuration_secret }}"
tower_migrated_from_secret: "{{ tower_old_postgres_configuration_secret }}"

View File

@@ -2,7 +2,7 @@
- name: Deploy AWX
k8s:
state: "{{ state | default('present') }}"
namespace: "{{ tower_namespace | default('default') }}"
namespace: "{{ namespace | default('default') }}"
apply: yes
wait: yes
template: "{{ tower_backup_dir }}/awx_object.yml"