More EC2 doc tweaks

reviewable/pr18780/r1
Michael DeHaan 10 years ago
parent c6b0d469ac
commit e7c92a6bc6

@ -18,9 +18,9 @@ DOCUMENTATION = '''
--- ---
module: ec2_ami module: ec2_ami
version_added: "1.3" version_added: "1.3"
short_description: create or destroy an image in ec2, return imageid short_description: create or destroy an image in ec2
description: description:
- Creates or deletes ec2 images. This module has a dependency on python-boto >= 2.5 - Creates or deletes ec2 images.
options: options:
instance_id: instance_id:
description: description:
@ -89,13 +89,10 @@ extends_documentation_fragment: aws
''' '''
# Thank you to iAcquire for sponsoring development of this module. # Thank you to iAcquire for sponsoring development of this module.
#
# See http://alestic.com/2011/06/ec2-ami-security for more information about ensuring the security of your AMI.
EXAMPLES = ''' EXAMPLES = '''
# Basic AMI Creation # Basic AMI Creation
- local_action: - ec2_ami:
module: ec2_ami
aws_access_key: xxxxxxxxxxxxxxxxxxxxxxx aws_access_key: xxxxxxxxxxxxxxxxxxxxxxx
aws_secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx aws_secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
instance_id: i-xxxxxx instance_id: i-xxxxxx
@ -104,8 +101,7 @@ EXAMPLES = '''
register: instance register: instance
# Basic AMI Creation, without waiting # Basic AMI Creation, without waiting
- local_action: - ec2_ami:
module: ec2_ami
aws_access_key: xxxxxxxxxxxxxxxxxxxxxxx aws_access_key: xxxxxxxxxxxxxxxxxxxxxxx
aws_secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx aws_secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
region: xxxxxx region: xxxxxx
@ -115,22 +111,20 @@ EXAMPLES = '''
register: instance register: instance
# Deregister/Delete AMI # Deregister/Delete AMI
- local_action: - ec2_ami:
module: ec2_ami
aws_access_key: xxxxxxxxxxxxxxxxxxxxxxx aws_access_key: xxxxxxxxxxxxxxxxxxxxxxx
aws_secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx aws_secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
region: xxxxxx region: xxxxxx
image_id: ${instance.image_id} image_id: "{{ instance.image_id }}"
delete_snapshot: True delete_snapshot: True
state: absent state: absent
# Deregister AMI # Deregister AMI
- local_action: - ec2_ami:
module: ec2_ami
aws_access_key: xxxxxxxxxxxxxxxxxxxxxxx aws_access_key: xxxxxxxxxxxxxxxxxxxxxxx
aws_secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx aws_secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
region: xxxxxx region: xxxxxx
image_id: ${instance.image_id} image_id: "{{ instance.image_id }}"
delete_snapshot: False delete_snapshot: False
state: absent state: absent

@ -16,10 +16,11 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
DOCUMENTATION = ''' DOCUMENTATION = '''
--- ---
module: ec2_ami_search module: ec2_ami_search
short_description: Retrieve AWS AMI for a given operating system. short_description: Retrieve AWS AMI information for a given operating system.
version_added: "1.6" version_added: "1.6"
description: description:
- Look up the most recent AMI on AWS for a given operating system. - Look up the most recent AMI on AWS for a given operating system.

@ -119,21 +119,23 @@ extends_documentation_fragment: aws
""" """
EXAMPLES = ''' EXAMPLES = '''
A basic example of configuration: # Basic configuration
- ec2_asg: - ec2_asg:
name: special name: special
load_balancers: 'lb1,lb2' load_balancers: [ 'lb1', 'lb2' ]
availability_zones: 'eu-west-1a,eu-west-1b' availability_zones: [ 'eu-west-1a', 'eu-west-1b' ]
launch_config_name: 'lc-1' launch_config_name: 'lc-1'
min_size: 1 min_size: 1
max_size: 10 max_size: 10
desired_capacity: 5 desired_capacity: 5
vpc_zone_identifier: 'subnet-abcd1234,subnet-1a2b3c4d' vpc_zone_identifier: [ 'subnet-abcd1234', 'subnet-1a2b3c4d' ]
tags: tags:
- environment: production - environment: production
propagate_at_launch: no propagate_at_launch: no
# Rolling ASG Updates
Below is an example of how to assign a new launch config to an ASG and terminate old instances. Below is an example of how to assign a new launch config to an ASG and terminate old instances.
All instances in "myasg" that do not have the launch configuration named "my_new_lc" will be terminated in All instances in "myasg" that do not have the launch configuration named "my_new_lc" will be terminated in
@ -415,9 +417,10 @@ def replace(connection, module):
max_size = module.params.get('max_size') max_size = module.params.get('max_size')
min_size = module.params.get('min_size') min_size = module.params.get('min_size')
desired_capacity = module.params.get('desired_capacity') desired_capacity = module.params.get('desired_capacity')
# FIXME: we need some more docs about this feature
replace_instances = module.params.get('replace_instances') replace_instances = module.params.get('replace_instances')
# wait for instance list to be populated on a newly provisioned ASG # wait for instance list to be populated on a newly provisioned ASG
instance_wait = time.time() + 30 instance_wait = time.time() + 30
while instance_wait > time.time(): while instance_wait > time.time():

@ -69,13 +69,13 @@ EXAMPLES = '''
ec2_eip: instance_id=i-1212f003 ec2_eip: instance_id=i-1212f003
- name: allocate a new elastic IP without associating it to anything - name: allocate a new elastic IP without associating it to anything
ec2_eip: action: ec2_eip
register: eip register: eip
- name: output the IP - name: output the IP
debug: msg="Allocated IP is {{ eip.public_ip }}" debug: msg="Allocated IP is {{ eip.public_ip }}"
- name: provision new instances with ec2 - name: provision new instances with ec2
ec2: keypair=mykey instance_type=c1.medium image=emi-40603AD1 wait=yes group=webserver count=3 ec2: keypair=mykey instance_type=c1.medium image=ami-40603AD1 wait=yes group=webserver count=3
register: ec2 register: ec2
- name: associate new elastic IPs with each of the instances - name: associate new elastic IPs with each of the instances
ec2_eip: "instance_id={{ item }}" ec2_eip: "instance_id={{ item }}"

@ -80,18 +80,18 @@ EXAMPLES = """
# basic pre_task and post_task example # basic pre_task and post_task example
pre_tasks: pre_tasks:
- name: Gathering ec2 facts - name: Gathering ec2 facts
ec2_facts: action: ec2_facts
- name: Instance De-register - name: Instance De-register
local_action: ec2_elb local_action:
args: module: ec2_elb
instance_id: "{{ ansible_ec2_instance_id }}" instance_id: "{{ ansible_ec2_instance_id }}"
state: 'absent' state: 'absent'
roles: roles:
- myrole - myrole
post_tasks: post_tasks:
- name: Instance Register - name: Instance Register
local_action: ec2_elb local_action:
args: module: ec2_elb
instance_id: "{{ ansible_ec2_instance_id }}" instance_id: "{{ ansible_ec2_instance_id }}"
ec2_elbs: "{{ item }}" ec2_elbs: "{{ item }}"
state: 'present' state: 'present'

@ -115,7 +115,8 @@ EXAMPLES = """
# Note: None of these examples set aws_access_key, aws_secret_key, or region. # Note: None of these examples set aws_access_key, aws_secret_key, or region.
# It is assumed that their matching environment variables are set. # It is assumed that their matching environment variables are set.
# Basic provisioning example # Basic provisioning example (non-VPC)
- local_action: - local_action:
module: ec2_elb_lb module: ec2_elb_lb
name: "test-please-delete" name: "test-please-delete"
@ -134,8 +135,8 @@ EXAMPLES = """
# ssl certificate required for https or ssl # ssl certificate required for https or ssl
ssl_certificate_id: "arn:aws:iam::123456789012:server-certificate/company/servercerts/ProdServerCert" ssl_certificate_id: "arn:aws:iam::123456789012:server-certificate/company/servercerts/ProdServerCert"
# Internal ELB example
# Basic VPC provisioning example
- local_action: - local_action:
module: ec2_elb_lb module: ec2_elb_lb
name: "test-vpc" name: "test-vpc"

@ -70,8 +70,7 @@ notes:
EXAMPLES = ''' EXAMPLES = '''
- name: example ec2 group - name: example ec2 group
local_action: ec2_group:
module: ec2_group
name: example name: example
description: an example EC2 group description: an example EC2 group
vpc_id: 12345 vpc_id: 12345

@ -56,15 +56,13 @@ EXAMPLES = '''
# Creates a new ec2 key pair named `example` if not present, returns generated # Creates a new ec2 key pair named `example` if not present, returns generated
# private key # private key
- name: example ec2 key - name: example ec2 key
local_action: ec2_key:
module: ec2_key
name: example name: example
# Creates a new ec2 key pair named `example` if not present using provided key # Creates a new ec2 key pair named `example` if not present using provided key
# material # material. This could use the 'file' lookup plugin to pull this off disk.
- name: example2 ec2 key - name: example2 ec2 key
local_action: ec2_key:
module: ec2_key
name: example2 name: example2
key_material: 'ssh-rsa AAAAxyz...== me@example.com' key_material: 'ssh-rsa AAAAxyz...== me@example.com'
state: present state: present
@ -72,16 +70,14 @@ EXAMPLES = '''
# Creates a new ec2 key pair named `example` if not present using provided key # Creates a new ec2 key pair named `example` if not present using provided key
# material # material
- name: example3 ec2 key - name: example3 ec2 key
local_action: ec2_key:
module: ec2_key
name: example3 name: example3
key_material: "{{ item }}" key_material: "{{ item }}"
with_file: /path/to/public_key.id_rsa.pub with_file: /path/to/public_key.id_rsa.pub
# Removes ec2 key pair by name # Removes ec2 key pair by name
- name: remove example key - name: remove example key
local_action: ec2_key:
module: ec2_key
name: example name: example
state: absent state: absent
''' '''

@ -125,7 +125,7 @@ EXAMPLES = '''
name: special name: special
image_id: ami-XXX image_id: ami-XXX
key_name: default key_name: default
security_groups: 'group,group2' security_groups: ['group', 'group2' ]
instance_type: t1.micro instance_type: t1.micro
''' '''

@ -68,21 +68,18 @@ extends_documentation_fragment: aws
EXAMPLES = ''' EXAMPLES = '''
# Simple snapshot of volume using volume_id # Simple snapshot of volume using volume_id
- local_action: - ec2_snapshot:
module: ec2_snapshot
volume_id: vol-abcdef12 volume_id: vol-abcdef12
description: snapshot of /data from DB123 taken 2013/11/28 12:18:32 description: snapshot of /data from DB123 taken 2013/11/28 12:18:32
# Snapshot of volume mounted on device_name attached to instance_id # Snapshot of volume mounted on device_name attached to instance_id
- local_action: - ec2_snapshot:
module: ec2_snapshot
instance_id: i-12345678 instance_id: i-12345678
device_name: /dev/sdb1 device_name: /dev/sdb1
description: snapshot of /data from DB123 taken 2013/11/28 12:18:32 description: snapshot of /data from DB123 taken 2013/11/28 12:18:32
# Snapshot of volume with tagging # Snapshot of volume with tagging
- local_action: - ec2_snapshot:
module: ec2_snapshot
instance_id: i-12345678 instance_id: i-12345678
device_name: /dev/sdb1 device_name: /dev/sdb1
snapshot_tags: snapshot_tags:

@ -50,7 +50,7 @@ EXAMPLES = '''
# Basic example of adding tag(s) # Basic example of adding tag(s)
tasks: tasks:
- name: tag a resource - name: tag a resource
local_action: ec2_tag resource=vol-XXXXXX region=eu-west-1 state=present ec2_tag: resource=vol-XXXXXX region=eu-west-1 state=present
args: args:
tags: tags:
Name: ubervol Name: ubervol
@ -59,11 +59,11 @@ tasks:
# Playbook example of adding tag(s) to spawned instances # Playbook example of adding tag(s) to spawned instances
tasks: tasks:
- name: launch some instances - name: launch some instances
local_action: ec2 keypair={{ keypair }} group={{ security_group }} instance_type={{ instance_type }} image={{ image_id }} wait=true region=eu-west-1 ec2: keypair={{ keypair }} group={{ security_group }} instance_type={{ instance_type }} image={{ image_id }} wait=true region=eu-west-1
register: ec2 register: ec2
- name: tag my launched instances - name: tag my launched instances
local_action: ec2_tag resource={{ item.id }} region=eu-west-1 state=present ec2_tag: resource={{ item.id }} region=eu-west-1 state=present
with_items: ec2.instances with_items: ec2.instances
args: args:
tags: tags:

@ -105,36 +105,31 @@ extends_documentation_fragment: aws
EXAMPLES = ''' EXAMPLES = '''
# Simple attachment action # Simple attachment action
- local_action: - ec2_vol:
module: ec2_vol
instance: XXXXXX instance: XXXXXX
volume_size: 5 volume_size: 5
device_name: sdd device_name: sdd
# Example using custom iops params # Example using custom iops params
- local_action: - ec2_vol:
module: ec2_vol
instance: XXXXXX instance: XXXXXX
volume_size: 5 volume_size: 5
iops: 200 iops: 200
device_name: sdd device_name: sdd
# Example using snapshot id # Example using snapshot id
- local_action: - ec2_vol:
module: ec2_vol
instance: XXXXXX instance: XXXXXX
snapshot: "{{ snapshot }}" snapshot: "{{ snapshot }}"
# Playbook example combined with instance launch # Playbook example combined with instance launch
- local_action: - ec2:
module: ec2
keypair: "{{ keypair }}" keypair: "{{ keypair }}"
image: "{{ image }}" image: "{{ image }}"
wait: yes wait: yes
count: 3 count: 3
register: ec2 register: ec2
- local_action: - ec2_vol:
module: ec2_vol
instance: "{{ item.id }} " instance: "{{ item.id }} "
volume_size: 5 volume_size: 5
with_items: ec2.instances with_items: ec2.instances
@ -144,8 +139,7 @@ EXAMPLES = '''
# * Nothing will happen if the volume is already attached. # * Nothing will happen if the volume is already attached.
# * Volume must exist in the same zone. # * Volume must exist in the same zone.
- local_action: - ec2:
module: ec2
keypair: "{{ keypair }}" keypair: "{{ keypair }}"
image: "{{ image }}" image: "{{ image }}"
zone: YYYYYY zone: YYYYYY
@ -154,8 +148,7 @@ EXAMPLES = '''
count: 1 count: 1
register: ec2 register: ec2
- local_action: - ec2_vol:
module: ec2_vol
instance: "{{ item.id }}" instance: "{{ item.id }}"
name: my_existing_volume_Name_tag name: my_existing_volume_Name_tag
device_name: /dev/xvdf device_name: /dev/xvdf
@ -163,23 +156,16 @@ EXAMPLES = '''
register: ec2_vol register: ec2_vol
# Remove a volume # Remove a volume
- local_action: - ec2_vol:
module: ec2_vol
id: vol-XXXXXXXX id: vol-XXXXXXXX
state: absent state: absent
# List volumes for an instance # List volumes for an instance
- local_action: - ec2_vol:
module: ec2_vol
instance: i-XXXXXX instance: i-XXXXXX
state: list state: list
''' '''
# Note: this module needs to be made idempotent. Possible solution is to use resource tags with the volumes.
# if state=present and it doesn't exist, create, tag and attach.
# Check for state by looking for volume attachment with tag (and against block device mapping?).
# Would personally like to revisit this in May when Eucalyptus also has tagging support (3.3).
import sys import sys
import time import time

@ -130,16 +130,14 @@ EXAMPLES = '''
# It is assumed that their matching environment variables are set. # It is assumed that their matching environment variables are set.
# Basic creation example: # Basic creation example:
local_action: ec2_vpc:
module: ec2_vpc
state: present state: present
cidr_block: 172.23.0.0/16 cidr_block: 172.23.0.0/16
resource_tags: { "Environment":"Development" } resource_tags: { "Environment":"Development" }
region: us-west-2 region: us-west-2
# Full creation example with subnets and optional availability zones. # Full creation example with subnets and optional availability zones.
# The absence or presence of subnets deletes or creates them respectively. # The absence or presence of subnets deletes or creates them respectively.
local_action: ec2_vpc:
module: ec2_vpc
state: present state: present
cidr_block: 172.22.0.0/16 cidr_block: 172.22.0.0/16
resource_tags: { "Environment":"Development" } resource_tags: { "Environment":"Development" }
@ -170,8 +168,7 @@ EXAMPLES = '''
register: vpc register: vpc
# Removal of a VPC by id # Removal of a VPC by id
local_action: ec2_vpc:
module: ec2_vpc
state: absent state: absent
vpc_id: vpc-aaaaaaa vpc_id: vpc-aaaaaaa
region: us-west-2 region: us-west-2

@ -111,8 +111,7 @@ EXAMPLES = """
# It is assumed that their matching environment variables are set. # It is assumed that their matching environment variables are set.
# Basic example # Basic example
- local_action: - elasticache:
module: elasticache
name: "test-please-delete" name: "test-please-delete"
state: present state: present
engine: memcached engine: memcached
@ -126,14 +125,12 @@ EXAMPLES = """
# Ensure cache cluster is gone # Ensure cache cluster is gone
- local_action: - elasticache:
module: elasticache
name: "test-please-delete" name: "test-please-delete"
state: absent state: absent
# Reboot cache cluster # Reboot cache cluster
- local_action: - elasticache:
module: elasticache
name: "test-please-delete" name: "test-please-delete"
state: rebooted state: rebooted

@ -224,44 +224,45 @@ requirements: [ "boto" ]
author: Bruce Pennypacker author: Bruce Pennypacker
''' '''
# FIXME: the command stuff needs a 'state' like alias to make things consistent -- MPD
EXAMPLES = ''' EXAMPLES = '''
# Basic mysql provisioning example # Basic mysql provisioning example
- rds: > - rds:
command=create command: create
instance_name=new_database instance_name: new_database
db_engine=MySQL db_engine: MySQL
size=10 size: 10
instance_type=db.m1.small instance_type: db.m1.small
username=mysql_admin username: mysql_admin
password=1nsecure password: 1nsecure
# Create a read-only replica and wait for it to become available # Create a read-only replica and wait for it to become available
- rds: > - rds:
command=replicate command: replicate
instance_name=new_database_replica instance_name: new_database_replica
source_instance=new_database source_instance: new_database
wait=yes wait: yes
wait_timeout=600 wait_timeout: 600
# Delete an instance, but create a snapshot before doing so # Delete an instance, but create a snapshot before doing so
- rds: > - rds:
command=delete command: delete
instance_name=new_database instance_name: new_database
snapshot=new_database_snapshot snapshot: new_database_snapshot
# Get facts about an instance # Get facts about an instance
- rds: > - rds:
command=facts command: facts
instance_name=new_database instance_name: new_database
register: new_database_facts register: new_database_facts
# Rename an instance and wait for the change to take effect # Rename an instance and wait for the change to take effect
- rds: > - rds:
command=modify command: modify
instance_name=new_database instance_name: new_database
new_instance_name=renamed_database new_instance_name: renamed_database
wait=yes wait: yes
''' '''
import sys import sys

@ -85,17 +85,18 @@ author: Scott Anderson
EXAMPLES = ''' EXAMPLES = '''
# Add or change a parameter group, in this case setting auto_increment_increment to 42 * 1024 # Add or change a parameter group, in this case setting auto_increment_increment to 42 * 1024
- rds_param_group: > - rds_param_group:
state=present state: present
name=norwegian_blue name: norwegian_blue
description=My Fancy Ex Parrot Group description: 'My Fancy Ex Parrot Group'
engine=mysql5.6 engine: 'mysql5.6'
params='{"auto_increment_increment": "42K"}' params:
auto_increment_increment: "42K"
# Remove a parameter group # Remove a parameter group
- rds_param_group: > - rds_param_group:
state=absent state: absent
name=norwegian_blue name: norwegian_blue
''' '''
import sys import sys

@ -71,8 +71,7 @@ author: Scott Anderson
EXAMPLES = ''' EXAMPLES = '''
# Add or change a subnet group # Add or change a subnet group
- local_action: - rds_subnet_group
module: rds_subnet_group
state: present state: present
name: norwegian-blue name: norwegian-blue
description: My Fancy Ex Parrot Subnet Group description: My Fancy Ex Parrot Subnet Group
@ -81,9 +80,9 @@ EXAMPLES = '''
- subnet-bbbbbbbb - subnet-bbbbbbbb
# Remove a parameter group # Remove a parameter group
- rds_param_group: > - rds_param_group:
state=absent state: absent
name=norwegian-blue name: norwegian-blue
''' '''
import sys import sys

@ -88,51 +88,53 @@ requirements: [ "boto" ]
author: Bruce Pennypacker author: Bruce Pennypacker
''' '''
# FIXME: the command stuff should have a more state like configuration alias -- MPD
EXAMPLES = ''' EXAMPLES = '''
# Add new.foo.com as an A record with 3 IPs # Add new.foo.com as an A record with 3 IPs
- route53: > - route53:
command=create command: create
zone=foo.com zone: foo.com
record=new.foo.com record: new.foo.com
type=A type: A
ttl=7200 ttl: 7200
value=1.1.1.1,2.2.2.2,3.3.3.3 value: 1.1.1.1,2.2.2.2,3.3.3.3
# Retrieve the details for new.foo.com # Retrieve the details for new.foo.com
- route53: > - route53:
command=get command: get
zone=foo.com zone: foo.com
record=new.foo.com record: new.foo.com
type=A type: A
register: rec register: rec
# Delete new.foo.com A record using the results from the get command # Delete new.foo.com A record using the results from the get command
- route53: > - route53:
command=delete command: delete
zone=foo.com zone: foo.com
record={{ rec.set.record }} record: "{{ rec.set.record }}"
type={{ rec.set.type }} type: "{{ rec.set.type }}"
value={{ rec.set.value }} value: "{{ rec.set.value }}"
# Add an AAAA record. Note that because there are colons in the value # Add an AAAA record. Note that because there are colons in the value
# that the entire parameter list must be quoted: # that the entire parameter list must be quoted:
- route53: > - route53:
command=create command: "create"
zone=foo.com zone: "foo.com"
record=localhost.foo.com record: "localhost.foo.com"
type=AAAA type: "AAAA"
ttl=7200 ttl: "7200"
value="::1" value: "::1"
# Add a TXT record. Note that TXT and SPF records must be surrounded # Add a TXT record. Note that TXT and SPF records must be surrounded
# by quotes when sent to Route 53: # by quotes when sent to Route 53:
- route53: > - route53:
command=create command: "create"
zone=foo.com zone: "foo.com"
record=localhost.foo.com record: "localhost.foo.com"
type=TXT type: "TXT"
ttl=7200 ttl: "7200"
value="\"bar\"" value: '"bar"'
''' '''

@ -103,28 +103,19 @@ author: Lester Wade, Ralph Tice
EXAMPLES = ''' EXAMPLES = '''
# Simple PUT operation # Simple PUT operation
- s3: bucket=mybucket object=/my/desired/key.txt src=/usr/local/myfile.txt mode=put - s3: bucket=mybucket object=/my/desired/key.txt src=/usr/local/myfile.txt mode=put
# Simple GET operation # Simple GET operation
- s3: bucket=mybucket object=/my/desired/key.txt dest=/usr/local/myfile.txt mode=get - s3: bucket=mybucket object=/my/desired/key.txt dest=/usr/local/myfile.txt mode=get
# GET/download and overwrite local file (trust remote)
- s3: bucket=mybucket object=/my/desired/key.txt dest=/usr/local/myfile.txt mode=get
# GET/download and do not overwrite local file (trust remote)
- s3: bucket=mybucket object=/my/desired/key.txt dest=/usr/local/myfile.txt mode=get force=false
# PUT/upload and overwrite remote file (trust local)
- s3: bucket=mybucket object=/my/desired/key.txt src=/usr/local/myfile.txt mode=put
# PUT/upload with metadata # PUT/upload with metadata
- s3: bucket=mybucket object=/my/desired/key.txt src=/usr/local/myfile.txt mode=put metadata='Content-Encoding=gzip'
# PUT/upload with multiple metadata
- s3: bucket=mybucket object=/my/desired/key.txt src=/usr/local/myfile.txt mode=put metadata='Content-Encoding=gzip,Cache-Control=no-cache' - s3: bucket=mybucket object=/my/desired/key.txt src=/usr/local/myfile.txt mode=put metadata='Content-Encoding=gzip,Cache-Control=no-cache'
# PUT/upload and do not overwrite remote file (trust local)
- s3: bucket=mybucket object=/my/desired/key.txt src=/usr/local/myfile.txt mode=put force=false
# Download an object as a string to use else where in your playbook
- s3: bucket=mybucket object=/my/desired/key.txt src=/usr/local/myfile.txt mode=getstr
# Create an empty bucket # Create an empty bucket
- s3: bucket=mybucket mode=create - s3: bucket=mybucket mode=create
# Create a bucket with key as directory
- s3: bucket=mybucket object=/my/directory/path mode=create # Create a bucket with key as directory, in the EU region
# Create an empty bucket in the EU region - s3: bucket=mybucket object=/my/directory/path mode=create region=eu-west-1
- s3: bucket=mybucket mode=create region=eu-west-1
# Delete a bucket and all contents # Delete a bucket and all contents
- s3: bucket=mybucket mode=delete - s3: bucket=mybucket mode=delete
''' '''

Loading…
Cancel
Save