Skip to content

Commit c25341b

Browse files
andrewlecuyerJeff McCormick
authored andcommitted
Delete CRDs and pgo client when deprovisioning, (CrunchyData#799)
and reinstall pgo client when updating
1 parent 6e14cac commit c25341b

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed

ansible/roles/pgo-operator/tasks/cleanup.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,14 @@
154154
no_log: false
155155
tags: deprovision
156156

157+
- name: Delete Custom Resource Definitions
158+
shell: |
159+
{{ kubectl_or_oc }} delete crds pgbackups.crunchydata.com pgclusters.crunchydata.com \
160+
pgpolicies.crunchydata.com pgreplicas.crunchydata.com pgtasks.crunchydata.com
161+
ignore_errors: yes
162+
no_log: false
163+
tags: deprovision
164+
157165
- name: Check for output directory
158166
stat:
159167
path: "{{ output_dir }}"
@@ -177,3 +185,14 @@
177185
state: directory
178186
mode: 0700
179187
tags: always
188+
189+
- name: Delete PGO client
190+
become: yes
191+
become_method: sudo
192+
file:
193+
state: absent
194+
path: "/usr/local/bin/pgo"
195+
when: pgo_client_install == "true"
196+
ignore_errors: yes
197+
no_log: false
198+
tags: deprovision

ansible/roles/pgo-operator/tasks/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@
186186
url: "{{ pgo_client_url }}/pgo"
187187
dest: "/usr/local/bin/pgo"
188188
mode: 0755
189+
force: yes
189190
when: uname_result.stdout == "Linux" and pgo_client_install == "true"
190191
tags: [install, update]
191192

hugo/content/Installation/install-with-ansible/uninstalling-operator.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ With the correct playbooks acquired and prerequisites satisfied, simply run
1717
the following command:
1818

1919
```bash
20-
ansible-playbook -i /path/to/inventory --tags=deprovision main.yml
20+
ansible-playbook -i /path/to/inventory --tags=deprovision --ask-become-pass main.yml
2121
```
2222

2323
If the Crunchy PostgreSQL Operator playbooks were installed using `yum`, use the
@@ -26,13 +26,15 @@ following commands:
2626
```bash
2727
export ANSIBLE_ROLES_PATH=/usr/share/ansible/roles/crunchydata
2828

29-
ansible-playbook -i /path/to/inventory --tags=deprovision \
29+
ansible-playbook -i /path/to/inventory --tags=deprovision --ask-become-pass \
3030
/usr/share/ansible/postgres-operator/playbooks/main.yml
3131
```
3232

3333
## Deleting `pgo` Client
3434

35-
To remove the `pgo` client, simply run the following command:
35+
If variable `pgo_client_install` is set to `true` in the `inventory` file, the `pgo` client will also be uninstalled when deprovisioning.
36+
37+
Otherwise, the `pgo` client can be manually uninstalled by running the following command:
3638

3739
```
3840
rm /usr/local/bin/pgo

hugo/content/Installation/install-with-ansible/updating-operator.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ of the service. Using the `update` flag will:
1414
* Recreate configuration maps used by operator
1515
* Remove any deprecated objects
1616
* Allow administrators to change settings configured in the `inventory`
17+
* Reinstall the `pgo` client if a new version is specified
1718

1819
The following assumes the proper [prerequisites are satisfied](/installation/install-with-ansible/prereq/prerequisites/)
1920
we can now update the PostgreSQL Operator.

0 commit comments

Comments
 (0)