diff --git a/README.md b/README.md index 0ab9d6de..65edb8d4 100644 --- a/README.md +++ b/README.md @@ -229,9 +229,12 @@ stringData: username: password: sslmode: prefer + type: unmanaged type: Opaque ``` +> It is possible to set a specific username, password, or database, but still have the database managed by the operator. In this case, when creating the postgres-configuration secret, the `type: managed` field should be added. + **Note**: The variable `sslmode` is valid for `external` databases only. The allowed values are: `prefer`, `disable`, `allow`, `require`, `verify-ca`, `verify-full`. #### Migrating data from an old AWX instance diff --git a/roles/backup/tasks/secrets.yml b/roles/backup/tasks/secrets.yml index 6ef987b4..66bc77ea 100644 --- a/roles/backup/tasks/secrets.yml +++ b/roles/backup/tasks/secrets.yml @@ -47,7 +47,7 @@ database_name: "{{ _postgres_configuration['resources'][0]['data']['database'] | b64decode }}" database_port: "{{ _postgres_configuration['resources'][0]['data']['port'] | b64decode }}" database_host: "{{ _postgres_configuration['resources'][0]['data']['host'] | b64decode }}" - database_type: "{{ _postgres_configuration['resources'][0]['data']['type'] | b64decode }}" + database_type: "{{ _postgres_configuration['resources'][0]['data']['type'] | b64decode | default('unmanaged')}}" - name: Template secrets into yaml set_fact: diff --git a/roles/installer/tasks/migrate_data.yml b/roles/installer/tasks/migrate_data.yml index 28604306..ca1bb7ae 100644 --- a/roles/installer/tasks/migrate_data.yml +++ b/roles/installer/tasks/migrate_data.yml @@ -16,7 +16,9 @@ field_selectors: - status.phase=Running register: postgres_pod - until: postgres_pod['resources'] | length + until: + - "postgres_pod['resources'] | length" + - "postgres_pod['resources'][0]['status']['phase'] == 'Running'" delay: 5 retries: 60 diff --git a/roles/installer/templates/tower_postgres.yaml.j2 b/roles/installer/templates/tower_postgres.yaml.j2 index a98086a8..98a8b4bd 100644 --- a/roles/installer/templates/tower_postgres.yaml.j2 +++ b/roles/installer/templates/tower_postgres.yaml.j2 @@ -53,17 +53,17 @@ spec: - name: POSTGRES_DB valueFrom: secretKeyRef: - name: '{{ meta.name }}-postgres-configuration' + name: '{{ tower_postgres_configuration_secret }}' key: database - name: POSTGRES_USER valueFrom: secretKeyRef: - name: '{{ meta.name }}-postgres-configuration' + name: '{{ tower_postgres_configuration_secret }}' key: username - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: - name: '{{ meta.name }}-postgres-configuration' + name: '{{ tower_postgres_configuration_secret }}' key: password - name: PGDATA value: '{{ tower_postgres_data_path }}'