Skip to content

Commit

Permalink
add default cluster name (#1129)
Browse files Browse the repository at this point in the history
* add default cluster name

* Update awx.ansible.com_awxrestores.yaml

Co-authored-by: Kirill Smirnov <[email protected]>
  • Loading branch information
dru90i and Kirill Smirnov authored Nov 30, 2022
1 parent 95a1fc0 commit f35bd7c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions config/crd/bases/awx.ansible.com_awxrestores.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ spec:
description: Name of the restored deployment. This should be different from the original deployment name
if the original deployment still exists.
type: string
cluster_name:
description: Cluster name
type: string
backup_name:
description: AWXBackup object name
type: string
Expand Down
3 changes: 3 additions & 0 deletions roles/restore/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ backup_pvc_namespace: '{{ ansible_operator_meta.namespace }}'
# Required: backup name, found on the awxbackup object
backup_dir: ''

# Default cluster name
cluster_name: 'cluster.local'

# Set no_log settings on certain tasks
no_log: true

Expand Down
3 changes: 1 addition & 2 deletions roles/restore/tasks/postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

- name: Set full resolvable host name for postgres pod
set_fact:
resolvable_db_host: "{{ awx_postgres_host }}.{{ ansible_operator_meta.namespace }}.svc.cluster.local"
resolvable_db_host: "{{ awx_postgres_host }}.{{ ansible_operator_meta.namespace }}.svc.{{ cluster_name }}"
no_log: "{{ no_log }}"
when: awx_postgres_type == 'managed'

Expand All @@ -76,7 +76,6 @@
pg_restore --clean --if-exists
-U {{ awx_postgres_user }}
-h {{ resolvable_db_host }}
-U {{ awx_postgres_user }}
-d {{ awx_postgres_database }}
-p {{ awx_postgres_port }}
no_log: "{{ no_log }}"
Expand Down

0 comments on commit f35bd7c

Please sign in to comment.