From a7595a69647c37484a61c3dc5abe595e99b730f6 Mon Sep 17 00:00:00 2001 From: Lester Wade Date: Thu, 25 Apr 2013 19:22:48 -0700 Subject: [PATCH] Fixed cloudformation docs and updated EXAMPLES section in the docs for these AWS modules. --- library/cloudformation | 12 ++++++------ library/ec2_vol | 36 ++++++++++++++++++++++++------------ library/s3 | 19 ++++++++++++++----- 3 files changed, 44 insertions(+), 23 deletions(-) diff --git a/library/cloudformation b/library/cloudformation index 494f46e191a..e08cea42469 100644 --- a/library/cloudformation +++ b/library/cloudformation @@ -67,12 +67,15 @@ options: default: "yes" choices: [ "yes", "no" ] aliases: [] +requirements: [ "boto" ] +author: James S. Martin +''' -examples: - +EXAMPLES = ''' + # Basic task example tasks: - name: launch ansible cloudformation example - cloudformation: > + action: cloudformation > stack_name="ansible-cloudformation" state=present region=us-east-1 disable_rollback=yes template=files/cloudformation-example.json @@ -82,9 +85,6 @@ examples: DiskType: ephemeral InstanceType: m1.small ClusterSize: 3 - -requirements: [ "boto" ] -author: James S. Martin ''' import boto.cloudformation.connection diff --git a/library/ec2_vol b/library/ec2_vol index 2899a47d590..04bc5959a10 100644 --- a/library/ec2_vol +++ b/library/ec2_vol @@ -52,22 +52,34 @@ options: required: false default: null aliases: [] -examples: - - code: 'local_action: ec2_vol instance=XXXXXX volume_size=5 device_name=sdd' - description: "Simple playbook example" - - code: | - - name: Launch instances - local_action: ec2 keypair=$keypair image=$image wait=yes count=3 - register: ec2 - - name: Create volumes and attach - local_action: ec2_vol instance=${item.id} volume_size=5 - with_items: ${ec2.instances} - register: ec2_vol - description: "Advanced - attaching multiple volumes to multiple instances" requirements: [ "boto" ] author: Lester Wade ''' +EXAMPLES = ''' +# Simple attachment action +local_action: + module: ec2_vol + instance: XXXXXX + volume_size: 5 + device_name: sdd + +# Playbook example combined with instance launch +local_action: + module: ec2 + keypair: $keypair + image: $image + wait: yes + count: 3 + register: ec2 +local_action: + module: ec2_vol + instance: ${item.id} + volume_size: 5 + with_items: ${ec2.instances} + register: ec2_vol +''' + # 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?). diff --git a/library/s3 b/library/s3 index 331285e12c0..981a34016fd 100644 --- a/library/s3 +++ b/library/s3 @@ -51,15 +51,24 @@ options: required: false default: false version_added: "1.2" -examples: - - code: 's3 bucket=mybucket path=/path/to/file state=present' - description: "Simple playbook example" - - code: 's3 bucket=mybucket path=/path/to/file state=present overwrite=yes' - description: "Will overwrite only if remote and local checksums do not match. Does not support files uploaded to s3 with multipart upload." requirements: [ "boto" ] author: Lester Wade ''' +EXAMPLES = ''' +# Simple PUT operation + module: s3 + bucket: mybucket + path: /path/to/file + state: present +# Force and overwrite if checksums don't match + module: s3 + bucket: mybucket + path: /path/to/file + state: present + overwrite: yes +''' + import sys import os import urlparse