mirror of
https://github.com/ansible/awx.git
synced 2026-02-24 22:46:01 -03:30
Merge pull request #5418 from shanemcd/downstream-k8s-changes
Pull in downstream changes to k8s installer Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
@@ -46,10 +46,3 @@
|
|||||||
- docker_registry_password is defined and docker_registry_password != ''
|
- docker_registry_password is defined and docker_registry_password != ''
|
||||||
msg: "Set the value of 'docker_registry_password' in the inventory file."
|
msg: "Set the value of 'docker_registry_password' in the inventory file."
|
||||||
when: dockerhub_base is not defined
|
when: dockerhub_base is not defined
|
||||||
|
|
||||||
- name: pg_admin_password should be defined
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- pg_admin_password is defined and pg_admin_password != ''
|
|
||||||
when:
|
|
||||||
- pg_hostname is not defined or pg_hostname == ''
|
|
||||||
|
|||||||
@@ -67,8 +67,7 @@
|
|||||||
-e POSTGRESQL_MAX_CONNECTIONS={{ pg_max_connections|default(1024) }} \
|
-e POSTGRESQL_MAX_CONNECTIONS={{ pg_max_connections|default(1024) }} \
|
||||||
-e POSTGRESQL_USER={{ pg_username }} \
|
-e POSTGRESQL_USER={{ pg_username }} \
|
||||||
-e POSTGRESQL_PASSWORD={{ pg_password | quote }} \
|
-e POSTGRESQL_PASSWORD={{ pg_password | quote }} \
|
||||||
-e POSTGRESQL_ADMIN_PASSWORD={{ pg_admin_password | quote }} \
|
-e POSTGRESQL_DATABASE={{ pg_database | quote }} \
|
||||||
-e POSTGRESQL_DATABASE={{ pg_database }} \
|
|
||||||
-e POSTGRESQL_VERSION=10 \
|
-e POSTGRESQL_VERSION=10 \
|
||||||
-n {{ kubernetes_namespace }}
|
-n {{ kubernetes_namespace }}
|
||||||
register: openshift_pg_activate
|
register: openshift_pg_activate
|
||||||
|
|||||||
@@ -39,11 +39,6 @@
|
|||||||
{{ kubectl_or_oc }} -n {{ kubernetes_namespace }} \
|
{{ kubectl_or_oc }} -n {{ kubernetes_namespace }} \
|
||||||
scale {{ deployment_object }} {{ kubernetes_deployment_name }} --replicas=0
|
scale {{ deployment_object }} {{ kubernetes_deployment_name }} --replicas=0
|
||||||
|
|
||||||
- name: Delete any existing management pod
|
|
||||||
shell: |
|
|
||||||
{{ kubectl_or_oc }} -n {{ kubernetes_namespace }} \
|
|
||||||
delete pod ansible-tower-management --grace-period=0 --ignore-not-found
|
|
||||||
|
|
||||||
- name: Wait for scale down
|
- name: Wait for scale down
|
||||||
shell: |
|
shell: |
|
||||||
{{ kubectl_or_oc }} -n {{ kubernetes_namespace }} get pods \
|
{{ kubectl_or_oc }} -n {{ kubernetes_namespace }} get pods \
|
||||||
@@ -55,63 +50,72 @@
|
|||||||
until: (tower_pods.stdout | trim) == '0'
|
until: (tower_pods.stdout | trim) == '0'
|
||||||
retries: 30
|
retries: 30
|
||||||
|
|
||||||
- name: Template management pod
|
- name: Setup Management Pod & Restore (External DB)
|
||||||
set_fact:
|
block:
|
||||||
management_pod: "{{ lookup('template', 'management-pod.yml.j2') }}"
|
- name: Delete any existing management pod
|
||||||
|
shell: |
|
||||||
|
{{ kubectl_or_oc }} -n {{ kubernetes_namespace }} \
|
||||||
|
delete pod ansible-tower-management --grace-period=0 --ignore-not-found
|
||||||
|
|
||||||
- name: Create management pod
|
- name: Template management pod
|
||||||
shell: |
|
set_fact:
|
||||||
echo {{ management_pod | quote }} | {{ kubectl_or_oc }} apply -f -
|
management_pod: "{{ lookup('template', 'management-pod.yml.j2') }}"
|
||||||
|
|
||||||
- name: Wait for management pod to start
|
- name: Create management pod
|
||||||
shell: |
|
shell: |
|
||||||
{{ kubectl_or_oc }} -n {{ kubernetes_namespace }} \
|
echo {{ management_pod | quote }} | {{ kubectl_or_oc }} apply -f -
|
||||||
get pod ansible-tower-management -o jsonpath="{.status.phase}"
|
|
||||||
register: result
|
|
||||||
until: result.stdout == "Running"
|
|
||||||
retries: 60
|
|
||||||
delay: 10
|
|
||||||
|
|
||||||
- name: Temporarily grant createdb role
|
- name: Wait for management pod to start
|
||||||
shell: |
|
shell: |
|
||||||
{{ kubectl_or_oc }} -n {{ kubernetes_namespace }} \
|
{{ kubectl_or_oc }} -n {{ kubernetes_namespace }} \
|
||||||
exec -i ansible-tower-management -- bash -c "PGPASSWORD={{ pg_password | quote }} \
|
get pod ansible-tower-management -o jsonpath="{.status.phase}"
|
||||||
scl enable rh-postgresql10 -- psql \
|
register: result
|
||||||
--host={{ pg_hostname | default('postgresql') }} \
|
until: result.stdout == "Running"
|
||||||
--port={{ pg_port | default('5432') }} \
|
retries: 60
|
||||||
--username=postgres \
|
delay: 10
|
||||||
--dbname=template1 -c 'ALTER USER {{ pg_username }} CREATEDB;'"
|
|
||||||
no_log: true
|
- name: Perform a PostgreSQL restore (for External Postgres)
|
||||||
|
shell: |
|
||||||
|
{{ kubectl_or_oc }} -n {{ kubernetes_namespace }} \
|
||||||
|
exec -i ansible-tower-management -- bash -c "PGPASSWORD={{ pg_password | quote }} \
|
||||||
|
scl enable rh-postgresql10 -- psql \
|
||||||
|
--host={{ pg_hostname | default('postgresql') }} \
|
||||||
|
--port={{ pg_port | default('5432') }} \
|
||||||
|
--username={{ pg_username }} \
|
||||||
|
--dbname=template1" < {{ playbook_dir }}/tower-openshift-restore/tower.db
|
||||||
|
no_log: yes
|
||||||
|
|
||||||
|
- name: Delete management pod
|
||||||
|
shell: |
|
||||||
|
{{ kubectl_or_oc }} -n {{ kubernetes_namespace }} \
|
||||||
|
delete pod ansible-tower-management --grace-period=0 --ignore-not-found
|
||||||
|
when: pg_hostname is defined or pg_hostname != ''
|
||||||
|
|
||||||
|
- name: Restore (Containerized DB)
|
||||||
|
block:
|
||||||
|
- name: Temporarily grant createdb role
|
||||||
|
shell: |
|
||||||
|
POD=$({{ kubectl_or_oc }} -n {{ kubernetes_namespace }} \
|
||||||
|
get pods -l=name=postgresql --field-selector status.phase=Running -o jsonpath="{.items[0].metadata.name}")
|
||||||
|
{{ kubectl_or_oc }} exec $POD -n {{ kubernetes_namespace }} -- bash -c "\
|
||||||
|
psql --dbname=template1 -c 'ALTER USER {{ pg_username }} CREATEDB;'"
|
||||||
|
|
||||||
|
- name: Perform a PostgreSQL restore
|
||||||
|
shell: |
|
||||||
|
POD=$({{ kubectl_or_oc }} -n {{ kubernetes_namespace }} \
|
||||||
|
get pods -l=name=postgresql --field-selector status.phase=Running -o jsonpath="{.items[0].metadata.name}")
|
||||||
|
{{ kubectl_or_oc }} exec -i $POD -n {{ kubernetes_namespace }} -- bash -c "\
|
||||||
|
psql --dbname=template1" < {{ playbook_dir }}/tower-openshift-restore/tower.db
|
||||||
|
no_log: yes
|
||||||
|
|
||||||
|
- name: Revoke createdb role
|
||||||
|
shell: |
|
||||||
|
POD=$({{ kubectl_or_oc }} -n {{ kubernetes_namespace }} \
|
||||||
|
get pods -l=name=postgresql --field-selector status.phase=Running -o jsonpath="{.items[0].metadata.name}")
|
||||||
|
{{ kubectl_or_oc }} exec $POD -n {{ kubernetes_namespace }} -- bash -c "\
|
||||||
|
psql --dbname=template1 -c 'ALTER USER {{ pg_username }} NOCREATEDB;'"
|
||||||
when: pg_hostname is not defined or pg_hostname == ''
|
when: pg_hostname is not defined or pg_hostname == ''
|
||||||
|
|
||||||
- name: Perform a PostgreSQL restore
|
|
||||||
shell: |
|
|
||||||
{{ kubectl_or_oc }} -n {{ kubernetes_namespace }} \
|
|
||||||
exec -i ansible-tower-management -- bash -c "PGPASSWORD={{ pg_password | quote }} \
|
|
||||||
scl enable rh-postgresql10 -- psql \
|
|
||||||
--host={{ pg_hostname | default('postgresql') }} \
|
|
||||||
--port={{ pg_port | default('5432') }} \
|
|
||||||
--username={{ pg_username }} \
|
|
||||||
--dbname=template1" < {{ playbook_dir }}/tower-openshift-restore/tower.db
|
|
||||||
no_log: true
|
|
||||||
|
|
||||||
- name: Revoke createdb role
|
|
||||||
shell: |
|
|
||||||
{{ kubectl_or_oc }} -n {{ kubernetes_namespace }} \
|
|
||||||
exec -i ansible-tower-management -- bash -c "PGPASSWORD={{ pg_password | quote }} \
|
|
||||||
scl enable rh-postgresql10 -- psql \
|
|
||||||
--host={{ pg_hostname | default('postgresql') }} \
|
|
||||||
--port={{ pg_port | default('5432') }} \
|
|
||||||
--username=postgres \
|
|
||||||
--dbname=template1 -c 'ALTER USER {{ pg_username }} NOCREATEDB;'"
|
|
||||||
no_log: true
|
|
||||||
when: pg_hostname is not defined or pg_hostname == ''
|
|
||||||
|
|
||||||
- name: Delete management pod
|
|
||||||
shell: |
|
|
||||||
{{ kubectl_or_oc }} -n {{ kubernetes_namespace }} \
|
|
||||||
delete pod ansible-tower-management --grace-period=0 --ignore-not-found
|
|
||||||
|
|
||||||
- name: Remove restore directory
|
- name: Remove restore directory
|
||||||
file:
|
file:
|
||||||
state: absent
|
state: absent
|
||||||
|
|||||||
@@ -3,9 +3,6 @@ DATABASE_NAME={{ pg_database }}
|
|||||||
DATABASE_HOST={{ pg_hostname|default('postgresql') }}
|
DATABASE_HOST={{ pg_hostname|default('postgresql') }}
|
||||||
DATABASE_PORT={{ pg_port|default('5432') }}
|
DATABASE_PORT={{ pg_port|default('5432') }}
|
||||||
DATABASE_PASSWORD={{ pg_password | quote }}
|
DATABASE_PASSWORD={{ pg_password | quote }}
|
||||||
{% if pg_admin_password is defined %}
|
|
||||||
DATABASE_ADMIN_PASSWORD={{ pg_admin_password|quote }}
|
|
||||||
{% endif %}
|
|
||||||
MEMCACHED_HOST={{ memcached_hostname|default('localhost') }}
|
MEMCACHED_HOST={{ memcached_hostname|default('localhost') }}
|
||||||
MEMCACHED_PORT={{ memcached_port|default('11211') }}
|
MEMCACHED_PORT={{ memcached_port|default('11211') }}
|
||||||
RABBITMQ_HOST={{ rabbitmq_hostname|default('localhost') }}
|
RABBITMQ_HOST={{ rabbitmq_hostname|default('localhost') }}
|
||||||
|
|||||||
@@ -92,11 +92,6 @@ objects:
|
|||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
key: database-password
|
key: database-password
|
||||||
name: ${DATABASE_SERVICE_NAME}
|
name: ${DATABASE_SERVICE_NAME}
|
||||||
- name: POSTGRESQL_ADMIN_PASSWORD
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
key: database-admin-password
|
|
||||||
name: ${DATABASE_SERVICE_NAME}
|
|
||||||
- name: POSTGRESQL_DATABASE
|
- name: POSTGRESQL_DATABASE
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
@@ -176,12 +171,6 @@ parameters:
|
|||||||
generate: expression
|
generate: expression
|
||||||
name: POSTGRESQL_PASSWORD
|
name: POSTGRESQL_PASSWORD
|
||||||
required: true
|
required: true
|
||||||
- description: Password for the PostgreSQL connection admin user.
|
|
||||||
displayName: PostgreSQL Connection Admin Password
|
|
||||||
from: '[a-zA-Z0-9]{16}'
|
|
||||||
generate: expression
|
|
||||||
name: POSTGRESQL_ADMIN_PASSWORD
|
|
||||||
required: true
|
|
||||||
- description: Name of the PostgreSQL database accessed.
|
- description: Name of the PostgreSQL database accessed.
|
||||||
displayName: PostgreSQL Database Name
|
displayName: PostgreSQL Database Name
|
||||||
name: POSTGRESQL_DATABASE
|
name: POSTGRESQL_DATABASE
|
||||||
|
|||||||
Reference in New Issue
Block a user