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
1,286 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 12, 2019 in Ansible by John
1,449 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, 2020 in Ansible by MD
• 95,460 points
1,103 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, 2020 in Ansible by MD
• 95,460 points
26,629 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, 2020 in Ansible by MD
• 95,460 points
11,238 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP