summaryrefslogtreecommitdiffstats
path: root/roles/openshift_aws/tasks
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2018-02-05 09:42:38 -0500
committerGitHub <noreply@github.com>2018-02-05 09:42:38 -0500
commit2c3803772e0ca31443c8e8deb215c0b771df7ee0 (patch)
treed45a01eb6fb0186e1345fd9c58185a01dc5d7bc6 /roles/openshift_aws/tasks
parent26caf813c55a090279260436ec315d8331bcc2e4 (diff)
parentf6afef5ca361340e31807919eeef255df75b17d3 (diff)
downloadopenshift-2c3803772e0ca31443c8e8deb215c0b771df7ee0.tar.gz
openshift-2c3803772e0ca31443c8e8deb215c0b771df7ee0.tar.bz2
openshift-2c3803772e0ca31443c8e8deb215c0b771df7ee0.tar.xz
openshift-2c3803772e0ca31443c8e8deb215c0b771df7ee0.zip
Merge pull request #6985 from joelddiaz/deprovision_s3_buckets
add S3 bucket cleanup
Diffstat (limited to 'roles/openshift_aws/tasks')
-rw-r--r--roles/openshift_aws/tasks/uninstall_s3.yml26
1 files changed, 26 insertions, 0 deletions
diff --git a/roles/openshift_aws/tasks/uninstall_s3.yml b/roles/openshift_aws/tasks/uninstall_s3.yml
new file mode 100644
index 000000000..0b08cbeed
--- /dev/null
+++ b/roles/openshift_aws/tasks/uninstall_s3.yml
@@ -0,0 +1,26 @@
+---
+- name: empty S3 bucket
+ block:
+ - name: get S3 object list
+ aws_s3:
+ bucket: "{{ openshift_aws_s3_bucket_name }}"
+ mode: list
+ region: "{{ openshift_aws_region }}"
+ register: s3_out
+
+ - name: delete S3 objects
+ aws_s3:
+ bucket: "{{ openshift_aws_s3_bucket_name }}"
+ mode: delobj
+ object: "{{ item }}"
+ with_items: "{{ s3_out.s3_keys }}"
+ when: openshift_aws_create_s3 | bool
+
+- name: delete S3 bucket
+ aws_s3:
+ bucket: "{{ openshift_aws_s3_bucket_name }}"
+ mode: delete
+ region: "{{ openshift_aws_region }}"
+ when:
+ - openshift_aws_create_s3 | bool
+ - openshift_aws_really_delete_s3_bucket | bool