Replaces the minimal project description with a comprehensive README including a component overview table, quick start instructions, common Ansible operations, and links to detailed documentation. Aligns with Red Panda Approval™ standards.
49 lines
1.5 KiB
YAML
49 lines
1.5 KiB
YAML
---
|
|
# Remove bucket - outputs confirmation to console
|
|
# Use with extreme caution - data loss is permanent
|
|
|
|
- name: Validate required variables
|
|
ansible.builtin.assert:
|
|
that:
|
|
- bucket_name is defined
|
|
fail_msg: "Required variable not defined: bucket_name"
|
|
|
|
- name: Set key name
|
|
ansible.builtin.set_fact:
|
|
key_name: "{{ bucket_name }}-access"
|
|
|
|
- name: Confirm deletion
|
|
ansible.builtin.pause:
|
|
prompt: "WARNING: This will permanently delete bucket '{{ bucket_name }}' and all its data. Type 'yes' to continue"
|
|
register: confirm_delete
|
|
|
|
- name: Abort if not confirmed
|
|
ansible.builtin.fail:
|
|
msg: "Deletion aborted by user"
|
|
when: confirm_delete.user_input != 'yes'
|
|
|
|
- name: Delete bucket key
|
|
ansible.builtin.command:
|
|
cmd: >
|
|
incus storage bucket key delete {{ storage_pool }} {{ bucket_name }} {{ key_name }}
|
|
--project={{ project_name }}
|
|
register: key_deleted
|
|
failed_when: false
|
|
|
|
- name: Delete storage bucket
|
|
ansible.builtin.command:
|
|
cmd: >
|
|
incus storage bucket delete {{ storage_pool }} {{ bucket_name }}
|
|
--project={{ project_name }}
|
|
register: bucket_deleted
|
|
|
|
- name: Display removal confirmation
|
|
ansible.builtin.debug:
|
|
msg:
|
|
- "============================================"
|
|
- "S3 BUCKET REMOVED: {{ bucket_name }}"
|
|
- "============================================"
|
|
- "Remember to remove credentials from vault.yml"
|
|
- "============================================"
|
|
when: bucket_deleted is succeeded
|