Skip to content

Instantly share code, notes, and snippets.

@jackl0phty
Created November 16, 2015 23:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jackl0phty/b86ed1d9fbde1bbb6ed0 to your computer and use it in GitHub Desktop.
Save jackl0phty/b86ed1d9fbde1bbb6ed0 to your computer and use it in GitHub Desktop.
How to Create an AWS S3 Bucket, tag it, Specify Region, & Enable Versioning Using Ansible.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "statement1",
"Effect": "Allow",
"Action": [
"s3:Put*",
"s3:Get*",
"s3:List*",
"s3:CreateBucket"
],
"Resource": [
"arn:aws:s3:::*"
]
}
]
}
---
- hosts: localhost
connection: local
gather_facts: no
tasks:
- name: Create S3 test bucket.
local_action:
module: s3
bucket: 'mybucket-foo'
mode: create
region: 'us-east-1'
mode: create
- name: Set tags to S3 test bucket.
local_action:
module: s3_bucket
name: 'mybucket-foo'
region: 'us-east-1'
versioning: yes
tags:
Name: mybucket-foo
env: prod
created_by: Ansible
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment