Ansible playbook to delete multiple S3 buckets

0 votes
How do I write an andible playbook to delete multiple s3 buckets? Do I need to use different tasks for each s3 delete?
Aug 30, 2019 in Ansible by Hari
220 views

1 answer to this question.

0 votes

Hey @Hari, you can use the following playbook for deleting multiple s3 buckets. One of the way of achieving this is by using seperate tasks for each delete task. I am not very sure if this is efficient but it works.

---
hosts: localhost
  gather_facts: no
  connection: local
  vars_files:
   - aws-creds.yml
  tasks:
  - name: To Delete S3 Bucket
    aws_s3:
      bucket: bucket01
      mode: delete
  - name: To Delete S3 Bucket
    aws_s3:
      bucket: bucket02
      mode: delete
  - name: To Delete S3 Bucket
    aws_s3:
      bucket: bucket03
      mode: delete
answered Aug 30, 2019 by Chris

Related Questions In Ansible

0 votes
1 answer

How do i set multiple authorized keys to my ansible playbook?

Try this: - name: Set up multiple authorized ...READ MORE

answered Feb 11, 2019 in Ansible by John
261 views
0 votes
1 answer

How to delete a key pair in AWS from Ansible-Playbook?

Hi@akhtar, You can use the ec2_key module in ...READ MORE

answered Aug 12 in Ansible by MD
• 57,560 points
39 views
0 votes
1 answer

How to add multiple lines in a file using Ansible playbook?

Hi@akhtar, You can update your file using lineinfile ...READ MORE

answered Sep 16 in Ansible by MD
• 57,560 points
28 views
0 votes
1 answer

How to copy multiple files to remote system using Ansible Playbook?

Hi@akhtar, You can use the copy module in ...READ MORE

answered Sep 16 in Ansible by MD
• 57,560 points
30 views
0 votes
1 answer