Examples syntax batch5 (#5622)
* Change example syntax on supervisorctl module * Change example syntax or _ec2_ami_search module * Change example syntax on cloudformation module * Change example syntax on ec2 module * Change example syntax on ec2_facts module * Change example syntax on ec2_eip module * Change example syntax on rds module * Change example syntax on route53 module * Change example syntax on s3 module * Change example syntax on digital_ocean module * Change example syntax on docker_service module * Change example syntax on cloudformation module * Change example syntax on gc_storage module * Change example syntax on gce module * Change example syntax on gce_mig module * Change example syntax on _glance_image module * Change example syntax on _keystone_user module * Change example syntax on _nova_keypair module * Change example syntax on _quantum_floating module * Change example syntax on _quantum_floating_ip_associate module * Change example syntax on _quantum_network module * Change example syntax on _quantum_router module * Change example syntax on _quantum_router_gateway module * Change example syntax on _quantum_router_interface module * Change example syntax on _quantum_subnet module * SQUASH _quantum_subnet * Add missing quotes
This commit is contained in:
parent
b56a9852ee
commit
38c0769abb
24 changed files with 385 additions and 167 deletions
|
@ -74,10 +74,18 @@ EXAMPLES = '''
|
||||||
connection: local
|
connection: local
|
||||||
tasks:
|
tasks:
|
||||||
- name: Get the Ubuntu precise AMI
|
- name: Get the Ubuntu precise AMI
|
||||||
ec2_ami_search: distro=ubuntu release=precise region=us-west-1 store=instance-store
|
ec2_ami_search:
|
||||||
|
distro: ubuntu
|
||||||
|
release: precise
|
||||||
|
region: us-west-1
|
||||||
|
store: instance-store
|
||||||
register: ubuntu_image
|
register: ubuntu_image
|
||||||
|
|
||||||
- name: Start the EC2 instance
|
- name: Start the EC2 instance
|
||||||
ec2: image={{ ubuntu_image.ami }} instance_type=m1.small key_name=mykey
|
ec2:
|
||||||
|
image: "{{ ubuntu_image.ami }}"
|
||||||
|
instance_type: m1.small
|
||||||
|
key_name: mykey
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import csv
|
import csv
|
||||||
|
|
|
@ -152,9 +152,11 @@ EXAMPLES = '''
|
||||||
# Use a template from a URL
|
# Use a template from a URL
|
||||||
- name: launch ansible cloudformation example
|
- name: launch ansible cloudformation example
|
||||||
cloudformation:
|
cloudformation:
|
||||||
stack_name="ansible-cloudformation" state=present
|
stack_name: "ansible-cloudformation"
|
||||||
region=us-east-1 disable_rollback=true
|
state: present
|
||||||
template_url=https://s3.amazonaws.com/my-bucket/cloudformation.template
|
region: us-east-1
|
||||||
|
disable_rollback: true
|
||||||
|
template_url: 'https://s3.amazonaws.com/my-bucket/cloudformation.template'
|
||||||
args:
|
args:
|
||||||
template_parameters:
|
template_parameters:
|
||||||
KeyName: jmartin
|
KeyName: jmartin
|
||||||
|
@ -167,10 +169,12 @@ EXAMPLES = '''
|
||||||
# Use a template from a URL, and assume a role to execute
|
# Use a template from a URL, and assume a role to execute
|
||||||
- name: launch ansible cloudformation example with role assumption
|
- name: launch ansible cloudformation example with role assumption
|
||||||
cloudformation:
|
cloudformation:
|
||||||
stack_name="ansible-cloudformation" state=present
|
stack_name: "ansible-cloudformation"
|
||||||
region=us-east-1 disable_rollback=true
|
state: present
|
||||||
template_url=https://s3.amazonaws.com/my-bucket/cloudformation.template
|
region: us-east-1
|
||||||
role_arn: arn:aws:iam::123456789012:role/cloudformation-iam-role
|
disable_rollback: true
|
||||||
|
template_url: 'https://s3.amazonaws.com/my-bucket/cloudformation.template'
|
||||||
|
role_arn: 'arn:aws:iam::123456789012:role/cloudformation-iam-role'
|
||||||
args:
|
args:
|
||||||
template_parameters:
|
template_parameters:
|
||||||
KeyName: jmartin
|
KeyName: jmartin
|
||||||
|
|
|
@ -431,12 +431,21 @@ EXAMPLES = '''
|
||||||
vpc_subnet_id: subnet-29e63245
|
vpc_subnet_id: subnet-29e63245
|
||||||
assign_public_ip: yes
|
assign_public_ip: yes
|
||||||
register: ec2
|
register: ec2
|
||||||
|
|
||||||
- name: Add new instance to host group
|
- name: Add new instance to host group
|
||||||
add_host: hostname={{ item.public_ip }} groupname=launched
|
add_host:
|
||||||
with_items: '{{ec2.instances}}'
|
hostname: "{{ item.public_ip }}"
|
||||||
|
groupname: launched
|
||||||
|
with_items: "{{ ec2.instances }}"
|
||||||
|
|
||||||
- name: Wait for SSH to come up
|
- name: Wait for SSH to come up
|
||||||
wait_for: host={{ item.public_dns_name }} port=22 delay=60 timeout=320 state=started
|
wait_for:
|
||||||
with_items: '{{ec2.instances}}'
|
host: "{{ item.public_dns_name }}"
|
||||||
|
port: 22
|
||||||
|
delay: 60
|
||||||
|
timeout: 320
|
||||||
|
state: started
|
||||||
|
with_items: "{{ ec2.instances }}"
|
||||||
|
|
||||||
- name: Configure instance(s)
|
- name: Configure instance(s)
|
||||||
hosts: launched
|
hosts: launched
|
||||||
|
|
|
@ -85,34 +85,67 @@ notes:
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: associate an elastic IP with an instance
|
- name: associate an elastic IP with an instance
|
||||||
ec2_eip: device_id=i-1212f003 ip=93.184.216.119
|
ec2_eip:
|
||||||
|
device_id: i-1212f003
|
||||||
|
ip: 93.184.216.119
|
||||||
|
|
||||||
- name: associate an elastic IP with a device
|
- name: associate an elastic IP with a device
|
||||||
ec2_eip: device_id=eni-c8ad70f3 ip=93.184.216.119
|
ec2_eip:
|
||||||
|
device_id: eni-c8ad70f3
|
||||||
|
ip: 93.184.216.119
|
||||||
|
|
||||||
- name: disassociate an elastic IP from an instance
|
- name: disassociate an elastic IP from an instance
|
||||||
ec2_eip: device_id=i-1212f003 ip=93.184.216.119 state=absent
|
ec2_eip:
|
||||||
|
device_id: i-1212f003
|
||||||
|
ip: 93.184.216.119
|
||||||
|
state: absent
|
||||||
|
|
||||||
- name: disassociate an elastic IP with a device
|
- name: disassociate an elastic IP with a device
|
||||||
ec2_eip: device_id=eni-c8ad70f3 ip=93.184.216.119 state=absent
|
ec2_eip:
|
||||||
|
device_id: eni-c8ad70f3
|
||||||
|
ip: 93.184.216.119
|
||||||
|
state: absent
|
||||||
|
|
||||||
- name: allocate a new elastic IP and associate it with an instance
|
- name: allocate a new elastic IP and associate it with an instance
|
||||||
ec2_eip: device_id=i-1212f003
|
ec2_eip:
|
||||||
|
device_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
|
||||||
action: 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: another way of allocating an elastic IP without associating it to anything
|
- name: another way of allocating an elastic IP without associating it to anything
|
||||||
ec2_eip: state='present'
|
ec2_eip:
|
||||||
|
state: 'present'
|
||||||
|
|
||||||
- name: provision new instances with ec2
|
- name: provision new instances with ec2
|
||||||
ec2: keypair=mykey instance_type=c1.medium image=ami-40603AD1 wait=yes'''
|
ec2:
|
||||||
''' group=webserver count=3
|
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: "device_id={{ item }}"
|
ec2_eip:
|
||||||
|
device_id: "{{ item }}"
|
||||||
with_items: "{{ ec2.instance_ids }}"
|
with_items: "{{ ec2.instance_ids }}"
|
||||||
|
|
||||||
- name: allocate a new elastic IP inside a VPC in us-west-2
|
- name: allocate a new elastic IP inside a VPC in us-west-2
|
||||||
ec2_eip: region=us-west-2 in_vpc=yes
|
ec2_eip:
|
||||||
|
region: us-west-2
|
||||||
|
in_vpc: yes
|
||||||
register: eip
|
register: eip
|
||||||
|
|
||||||
- name: output the IP
|
- name: output the IP
|
||||||
debug: msg="Allocated IP inside a VPC is {{ eip.public_ip }}"
|
debug:
|
||||||
|
msg: "Allocated IP inside a VPC is {{ eip.public_ip }}"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -42,10 +42,11 @@ author: "Silviu Dicu (@silviud) <silviudicu@gmail.com>"
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Conditional example
|
# Conditional example
|
||||||
- name: Gather facts
|
- name: Gather facts
|
||||||
action: ec2_facts
|
ec2_facts:
|
||||||
|
|
||||||
- name: Conditional
|
- name: Conditional
|
||||||
action: debug msg="This instance is a t1.micro"
|
debug:
|
||||||
|
msg: "This instance is a t1.micro"
|
||||||
when: ansible_ec2_instance_type == "t1.micro"
|
when: ansible_ec2_instance_type == "t1.micro"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
|
@ -302,8 +302,8 @@ EXAMPLES = '''
|
||||||
region: us-west-2
|
region: us-west-2
|
||||||
vpc_security_groups: sg-xxx945xx
|
vpc_security_groups: sg-xxx945xx
|
||||||
|
|
||||||
- debug: msg="The new db endpoint is {{ rds.instance.endpoint }}"
|
- debug:
|
||||||
|
msg: "The new db endpoint is {{ rds.instance.endpoint }}"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
|
@ -228,13 +228,13 @@ EXAMPLES = '''
|
||||||
|
|
||||||
# Add an alias record that points to an Amazon ELB:
|
# Add an alias record that points to an Amazon ELB:
|
||||||
- route53:
|
- route53:
|
||||||
command=create
|
command: create
|
||||||
zone=foo.com
|
zone: foo.com
|
||||||
record=elb.foo.com
|
record: elb.foo.com
|
||||||
type=A
|
type: A
|
||||||
value="{{ elb_dns_name }}"
|
value: "{{ elb_dns_name }}"
|
||||||
alias=True
|
alias: True
|
||||||
alias_hosted_zone_id="{{ elb_zone_id }}"
|
alias_hosted_zone_id: "{{ elb_zone_id }}"
|
||||||
|
|
||||||
# Retrieve the details for elb.foo.com
|
# Retrieve the details for elb.foo.com
|
||||||
- route53:
|
- route53:
|
||||||
|
@ -257,14 +257,14 @@ EXAMPLES = '''
|
||||||
|
|
||||||
# Add an alias record that points to an Amazon ELB and evaluates it health:
|
# Add an alias record that points to an Amazon ELB and evaluates it health:
|
||||||
- route53:
|
- route53:
|
||||||
command=create
|
command: create
|
||||||
zone=foo.com
|
zone: foo.com
|
||||||
record=elb.foo.com
|
record: elb.foo.com
|
||||||
type=A
|
type: A
|
||||||
value="{{ elb_dns_name }}"
|
value: "{{ elb_dns_name }}"
|
||||||
alias=True
|
alias: True
|
||||||
alias_hosted_zone_id="{{ elb_zone_id }}"
|
alias_hosted_zone_id: "{{ elb_zone_id }}"
|
||||||
alias_evaluate_target_health=True
|
alias_evaluate_target_health: True
|
||||||
|
|
||||||
# Add an AAAA record with Hosted Zone ID. Note that because there are colons in the value
|
# Add an AAAA record with Hosted Zone ID. 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:
|
||||||
|
|
|
@ -154,44 +154,97 @@ extends_documentation_fragment: aws
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Simple PUT operation
|
- name: 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 PUT operation in Ceph RGW S3
|
- name: Simple PUT operation in Ceph RGW S3
|
||||||
- s3: bucket=mybucket object=/my/desired/key.txt src=/usr/local/myfile.txt mode=put rgw=true s3_url=http://localhost:8000
|
s3:
|
||||||
|
bucket: mybucket
|
||||||
|
object: /my/desired/key.txt
|
||||||
|
src: /usr/local/myfile.txt
|
||||||
|
mode: put
|
||||||
|
rgw: true
|
||||||
|
s3_url: "http://localhost:8000"
|
||||||
|
|
||||||
# Simple GET operation
|
- name: 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 a specific version of an object.
|
- name: Get a specific version of an object.
|
||||||
- s3: bucket=mybucket object=/my/desired/key.txt version=48c9ee5131af7a716edc22df9772aa6f dest=/usr/local/myfile.txt mode=get
|
s3:
|
||||||
|
bucket: mybucket
|
||||||
|
object: /my/desired/key.txt
|
||||||
|
version: 48c9ee5131af7a716edc22df9772aa6f
|
||||||
|
dest: /usr/local/myfile.txt
|
||||||
|
mode: get
|
||||||
|
|
||||||
# PUT/upload with metadata
|
- name: PUT/upload with 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 with custom headers
|
- name: PUT/upload with custom headers
|
||||||
- s3: bucket=mybucket object=/my/desired/key.txt src=/usr/local/myfile.txt mode=put headers=x-amz-grant-full-control=emailAddress=owner@example.com
|
s3:
|
||||||
|
bucket: mybucket
|
||||||
|
object: /my/desired/key.txt
|
||||||
|
src: /usr/local/myfile.txt
|
||||||
|
mode: put
|
||||||
|
headers: 'x-amz-grant-full-control=emailAddress=owner@example.com'
|
||||||
|
|
||||||
# List keys simple
|
- name: List keys simple
|
||||||
- s3: bucket=mybucket mode=list
|
s3:
|
||||||
|
bucket: mybucket
|
||||||
|
mode: list
|
||||||
|
|
||||||
# List keys all options
|
- name: List keys all options
|
||||||
- s3: bucket=mybucket mode=list prefix=/my/desired/ marker=/my/desired/0023.txt max_keys=472
|
s3:
|
||||||
|
bucket: mybucket
|
||||||
|
mode: list
|
||||||
|
prefix: /my/desired/
|
||||||
|
marker: /my/desired/0023.txt
|
||||||
|
max_keys: 472
|
||||||
|
|
||||||
# Create an empty bucket
|
- name: Create an empty bucket
|
||||||
- s3: bucket=mybucket mode=create permission=public-read
|
s3:
|
||||||
|
bucket: mybucket
|
||||||
|
mode: create
|
||||||
|
permission: public-read
|
||||||
|
|
||||||
# Create a bucket with key as directory, in the EU region
|
- name: Create a bucket with key as directory, in the EU region
|
||||||
- s3: bucket=mybucket object=/my/directory/path mode=create region=eu-west-1
|
s3:
|
||||||
|
bucket: mybucket
|
||||||
|
object: /my/directory/path
|
||||||
|
mode: create
|
||||||
|
region: eu-west-1
|
||||||
|
|
||||||
# Delete a bucket and all contents
|
- name: Delete a bucket and all contents
|
||||||
- s3: bucket=mybucket mode=delete
|
s3:
|
||||||
|
bucket: mybucket
|
||||||
|
mode: delete
|
||||||
|
|
||||||
# GET an object but dont download if the file checksums match. New in 2.0
|
- name: GET an object but dont download if the file checksums match. New in 2.0
|
||||||
- s3: bucket=mybucket object=/my/desired/key.txt dest=/usr/local/myfile.txt mode=get overwrite=different
|
s3:
|
||||||
|
bucket: mybucket
|
||||||
|
object: /my/desired/key.txt
|
||||||
|
dest: /usr/local/myfile.txt
|
||||||
|
mode: get
|
||||||
|
overwrite: different
|
||||||
|
|
||||||
# Delete an object from a bucket
|
- name: Delete an object from a bucket
|
||||||
- s3: bucket=mybucket object=/my/desired/key.txt mode=delobj
|
s3:
|
||||||
|
bucket: mybucket
|
||||||
|
object: /my/desired/key.txt
|
||||||
|
mode: delobj
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
|
@ -141,11 +141,13 @@ EXAMPLES = '''
|
||||||
region_id: ams2
|
region_id: ams2
|
||||||
image_id: fedora-19-x64
|
image_id: fedora-19-x64
|
||||||
wait_timeout: 500
|
wait_timeout: 500
|
||||||
|
|
||||||
register: my_droplet
|
register: my_droplet
|
||||||
|
|
||||||
- debug: msg="ID is {{ my_droplet.droplet.id }}"
|
- debug:
|
||||||
- debug: msg="IP is {{ my_droplet.droplet.ip_address }}"
|
msg: "ID is {{ my_droplet.droplet.id }}"
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: "IP is {{ my_droplet.droplet.ip_address }}"
|
||||||
|
|
||||||
# Ensure a droplet is present
|
# Ensure a droplet is present
|
||||||
# If droplet id already exist, will return the droplet details and changed = False
|
# If droplet id already exist, will return the droplet details and changed = False
|
||||||
|
|
|
@ -190,14 +190,16 @@ EXAMPLES = '''
|
||||||
project_src: flask
|
project_src: flask
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- debug: var=output
|
- debug:
|
||||||
|
var: output
|
||||||
|
|
||||||
- docker_service:
|
- docker_service:
|
||||||
project_src: flask
|
project_src: flask
|
||||||
build: no
|
build: no
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- debug: var=output
|
- debug:
|
||||||
|
var: output
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that: "not output.changed "
|
that: "not output.changed "
|
||||||
|
@ -208,7 +210,8 @@ EXAMPLES = '''
|
||||||
stopped: true
|
stopped: true
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- debug: var=output
|
- debug:
|
||||||
|
var: output
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
|
@ -221,7 +224,8 @@ EXAMPLES = '''
|
||||||
restarted: true
|
restarted: true
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- debug: var=output
|
- debug:
|
||||||
|
var: output
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
|
@ -239,7 +243,8 @@ EXAMPLES = '''
|
||||||
web: 2
|
web: 2
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- debug: var=output
|
- debug:
|
||||||
|
var: output
|
||||||
|
|
||||||
- name: Run with inline v2 compose
|
- name: Run with inline v2 compose
|
||||||
hosts: localhost
|
hosts: localhost
|
||||||
|
@ -268,7 +273,8 @@ EXAMPLES = '''
|
||||||
- db
|
- db
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- debug: var=output
|
- debug:
|
||||||
|
var: output
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
|
@ -300,7 +306,8 @@ EXAMPLES = '''
|
||||||
- db
|
- db
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- debug: var=output
|
- debug:
|
||||||
|
var: output
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
|
|
|
@ -96,26 +96,49 @@ author: "Benno Joy (@bennojoy)"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# upload some content
|
- name: Upload some content
|
||||||
- gc_storage: bucket=mybucket object=key.txt src=/usr/local/myfile.txt mode=put permission=public-read
|
gc_storage:
|
||||||
|
bucket: mybucket
|
||||||
|
object: key.txt
|
||||||
|
src: /usr/local/myfile.txt
|
||||||
|
mode: put
|
||||||
|
permission: public-read
|
||||||
|
|
||||||
# upload some headers
|
- name: Upload some headers
|
||||||
- gc_storage: bucket=mybucket object=key.txt src=/usr/local/myfile.txt headers='{"Content-Encoding": "gzip"}'
|
gc_storage:
|
||||||
|
bucket: mybucket
|
||||||
|
object: key.txt
|
||||||
|
src: /usr/local/myfile.txt
|
||||||
|
headers: '{"Content-Encoding": "gzip"}'
|
||||||
|
|
||||||
# download some content
|
- name: Download some content
|
||||||
- gc_storage: bucket=mybucket object=key.txt dest=/usr/local/myfile.txt mode=get
|
gc_storage:
|
||||||
|
bucket: mybucket
|
||||||
|
object: key.txt
|
||||||
|
dest: /usr/local/myfile.txt
|
||||||
|
mode: get
|
||||||
|
|
||||||
# Download an object as a string to use else where in your playbook
|
- name: Download an object as a string to use else where in your playbook
|
||||||
- gc_storage: bucket=mybucket object=key.txt mode=get_str
|
gc_storage:
|
||||||
|
bucket: mybucket
|
||||||
|
object: key.txt
|
||||||
|
mode: get_str
|
||||||
|
|
||||||
# Create an empty bucket
|
- name: Create an empty bucket
|
||||||
- gc_storage: bucket=mybucket mode=create
|
gc_storage:
|
||||||
|
bucket: mybucket
|
||||||
|
mode: create
|
||||||
|
|
||||||
# Create a bucket with key as directory
|
- name: Create a bucket with key as directory
|
||||||
- gc_storage: bucket=mybucket object=/my/directory/path mode=create
|
gc_storage:
|
||||||
|
bucket: mybucket
|
||||||
|
object: /my/directory/path
|
||||||
|
mode: create
|
||||||
|
|
||||||
# Delete a bucket and all contents
|
- name: Delete a bucket and all contents
|
||||||
- gc_storage: bucket=mybucket mode=delete
|
gc_storage:
|
||||||
|
bucket: mybucket
|
||||||
|
mode: delete
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
|
@ -258,11 +258,18 @@ EXAMPLES = '''
|
||||||
register: gce
|
register: gce
|
||||||
|
|
||||||
- name: Save host data
|
- name: Save host data
|
||||||
add_host: hostname={{ item.public_ip }} groupname=gce_instances_ips
|
add_host:
|
||||||
|
hostname: "{{ item.public_ip }}"
|
||||||
|
groupname: gce_instances_ips
|
||||||
with_items: "{{ gce.instance_data }}"
|
with_items: "{{ gce.instance_data }}"
|
||||||
|
|
||||||
- name: Wait for SSH for instances
|
- name: Wait for SSH for instances
|
||||||
wait_for: delay=1 host={{ item.public_ip }} port=22 state=started timeout=30
|
wait_for:
|
||||||
|
delay: 1
|
||||||
|
host: "{{ item.public_ip }}"
|
||||||
|
port: 22
|
||||||
|
state: started
|
||||||
|
timeout: 30
|
||||||
with_items: "{{ gce.instance_data }}"
|
with_items: "{{ gce.instance_data }}"
|
||||||
|
|
||||||
- name: Configure Hosts
|
- name: Configure Hosts
|
||||||
|
|
|
@ -116,7 +116,11 @@ EXAMPLES = '''
|
||||||
port: 80
|
port: 80
|
||||||
- name: foobar
|
- name: foobar
|
||||||
port: 82
|
port: 82
|
||||||
- pause: seconds=30
|
|
||||||
|
- name: Pause for 30 seconds
|
||||||
|
pause:
|
||||||
|
seconds: 30
|
||||||
|
|
||||||
- name: Recreate MIG Instances with Instance Template change.
|
- name: Recreate MIG Instances with Instance Template change.
|
||||||
gce_mig:
|
gce_mig:
|
||||||
name: ansible-mig-example
|
name: ansible-mig-example
|
||||||
|
@ -124,13 +128,18 @@ EXAMPLES = '''
|
||||||
state: present
|
state: present
|
||||||
template: my-instance-template-2-small
|
template: my-instance-template-2-small
|
||||||
recreate_instances: yes
|
recreate_instances: yes
|
||||||
- pause: seconds=30
|
|
||||||
|
- name: Pause for 30 seconds
|
||||||
|
pause:
|
||||||
|
seconds: 30
|
||||||
|
|
||||||
- name: Resize MIG
|
- name: Resize MIG
|
||||||
gce_mig:
|
gce_mig:
|
||||||
name: ansible-mig-example
|
name: ansible-mig-example
|
||||||
zone: us-central1-c
|
zone: us-central1-c
|
||||||
state: present
|
state: present
|
||||||
size: 3
|
size: 3
|
||||||
|
|
||||||
- name: Update MIG with Autoscaler
|
- name: Update MIG with Autoscaler
|
||||||
gce_mig:
|
gce_mig:
|
||||||
name: ansible-mig-example
|
name: ansible-mig-example
|
||||||
|
@ -150,7 +159,11 @@ EXAMPLES = '''
|
||||||
target: .39
|
target: .39
|
||||||
load_balancing_utilization:
|
load_balancing_utilization:
|
||||||
target: 0.4
|
target: 0.4
|
||||||
- pause: seconds=30
|
|
||||||
|
- name: Pause for 30 seconds
|
||||||
|
pause:
|
||||||
|
seconds: 30
|
||||||
|
|
||||||
- name: Delete MIG
|
- name: Delete MIG
|
||||||
gce_mig:
|
gce_mig:
|
||||||
name: ansible-mig-example
|
name: ansible-mig-example
|
||||||
|
|
|
@ -117,15 +117,16 @@ requirements: ["glanceclient", "keystoneclient"]
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Upload an image from an HTTP URL
|
- name: Upload an image from an HTTP URL
|
||||||
- glance_image: login_username=admin
|
glance_image:
|
||||||
login_password=passme
|
login_username: admin
|
||||||
login_tenant_name=admin
|
login_password: passme
|
||||||
name=cirros
|
login_tenant_name: admin
|
||||||
container_format=bare
|
name: cirros
|
||||||
disk_format=qcow2
|
container_format: bare
|
||||||
state=present
|
disk_format: qcow2
|
||||||
copy_from=http:launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img
|
state: present
|
||||||
|
copy_from: 'http://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img'
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
|
@ -94,14 +94,22 @@ author: "Ansible Core Team (deprecated)"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Create a tenant
|
- name: Create a tenant
|
||||||
- keystone_user: tenant=demo tenant_description="Default Tenant"
|
keystone_user:
|
||||||
|
tenant: demo
|
||||||
|
tenant_description: "Default Tenant"
|
||||||
|
|
||||||
# Create a user
|
- name: Create a user
|
||||||
- keystone_user: user=john tenant=demo password=secrete
|
keystone_user:
|
||||||
|
user: john
|
||||||
|
tenant: demo
|
||||||
|
password: secrete
|
||||||
|
|
||||||
# Apply the admin role to the john user in the demo tenant
|
- name: Apply the admin role to the john user in the demo tenant
|
||||||
- keystone_user: role=admin user=john tenant=demo
|
keystone_user:
|
||||||
|
role: admin
|
||||||
|
user: john
|
||||||
|
tenant: demo
|
||||||
'''
|
'''
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -80,14 +80,22 @@ options:
|
||||||
requirements: ["novaclient"]
|
requirements: ["novaclient"]
|
||||||
'''
|
'''
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Creates a key pair with the running users public key
|
- name: Create a key pair with the running users public key
|
||||||
- nova_keypair: state=present login_username=admin
|
nova_keypair:
|
||||||
login_password=admin login_tenant_name=admin name=ansible_key
|
state: present
|
||||||
public_key={{ lookup('file','~/.ssh/id_rsa.pub') }}
|
login_username: admin
|
||||||
|
login_password: admin
|
||||||
|
login_tenant_name: admin
|
||||||
|
name: ansible_key
|
||||||
|
public_key: "{{ lookup('file','~/.ssh/id_rsa.pub') }}"
|
||||||
|
|
||||||
# Creates a new key pair and the private key returned after the run.
|
- name: Create a new key pair and the private key returned after the run.
|
||||||
- nova_keypair: state=present login_username=admin login_password=admin
|
nova_keypair:
|
||||||
login_tenant_name=admin name=ansible_key
|
state: present
|
||||||
|
login_username: admin
|
||||||
|
login_password: admin
|
||||||
|
login_tenant_name: admin
|
||||||
|
name: ansible_key
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
@ -89,10 +89,15 @@ requirements: ["novaclient", "quantumclient", "neutronclient", "keystoneclient"]
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Assign a floating ip to the instance from an external network
|
- name: Assign a floating ip to the instance from an external network
|
||||||
- quantum_floating_ip: state=present login_username=admin login_password=admin
|
quantum_floating_ip:
|
||||||
login_tenant_name=admin network_name=external_network
|
state: present
|
||||||
instance_name=vm1 internal_network_name=internal_network
|
login_username: admin
|
||||||
|
login_password: admin
|
||||||
|
login_tenant_name: admin
|
||||||
|
network_name: external_network
|
||||||
|
instance_name: vm1
|
||||||
|
internal_network_name: internal_network
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def _get_ksclient(module, kwargs):
|
def _get_ksclient(module, kwargs):
|
||||||
|
|
|
@ -81,14 +81,14 @@ requirements: ["quantumclient", "neutronclient", "keystoneclient"]
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Associate a specific floating IP with an Instance
|
- name: Associate a specific floating IP with an Instance
|
||||||
- quantum_floating_ip_associate:
|
quantum_floating_ip_associate:
|
||||||
state=present
|
state: present
|
||||||
login_username=admin
|
login_username: admin
|
||||||
login_password=admin
|
login_password: admin
|
||||||
login_tenant_name=admin
|
login_tenant_name: admin
|
||||||
ip_address=1.1.1.1
|
ip_address: 1.1.1.1
|
||||||
instance_name=vm1
|
instance_name: vm1
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def _get_ksclient(module, kwargs):
|
def _get_ksclient(module, kwargs):
|
||||||
|
|
|
@ -109,15 +109,26 @@ requirements: ["quantumclient", "neutronclient", "keystoneclient"]
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Create a GRE backed Quantum network with tunnel id 1 for tenant1
|
- name: Create a GRE backed Quantum network with tunnel id 1 for tenant1
|
||||||
- quantum_network: name=t1network tenant_name=tenant1 state=present
|
quantum_network:
|
||||||
provider_network_type=gre provider_segmentation_id=1
|
name: t1network
|
||||||
login_username=admin login_password=admin login_tenant_name=admin
|
tenant_name: tenant1
|
||||||
|
state: present
|
||||||
|
provider_network_type: gre
|
||||||
|
provider_segmentation_id: 1
|
||||||
|
login_username: admin
|
||||||
|
login_password: admin
|
||||||
|
login_tenant_name: admin
|
||||||
|
|
||||||
# Create an external network
|
- name: Create an external network
|
||||||
- quantum_network: name=external_network state=present
|
quantum_network:
|
||||||
provider_network_type=local router_external=yes
|
name: external_network
|
||||||
login_username=admin login_password=admin login_tenant_name=admin
|
state: present
|
||||||
|
provider_network_type: local
|
||||||
|
router_external: yes
|
||||||
|
login_username: admin
|
||||||
|
login_password: admin
|
||||||
|
login_tenant_name: admin
|
||||||
'''
|
'''
|
||||||
|
|
||||||
_os_keystone = None
|
_os_keystone = None
|
||||||
|
|
|
@ -84,12 +84,13 @@ requirements: ["quantumclient", "neutronclient", "keystoneclient"]
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Creates a router for tenant admin
|
- name: Create a router for tenant admin
|
||||||
- quantum_router: state=present
|
quantum_router:
|
||||||
login_username=admin
|
state: present
|
||||||
login_password=admin
|
login_username: admin
|
||||||
login_tenant_name=admin
|
login_password: admin
|
||||||
name=router1"
|
login_tenant_name: admin
|
||||||
|
name: router1
|
||||||
'''
|
'''
|
||||||
|
|
||||||
_os_keystone = None
|
_os_keystone = None
|
||||||
|
|
|
@ -78,10 +78,14 @@ requirements: ["quantumclient", "neutronclient", "keystoneclient"]
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Attach an external network with a router to allow flow of external traffic
|
- name: Attach an external network with a router to allow flow of external traffic
|
||||||
- quantum_router_gateway: state=present login_username=admin login_password=admin
|
quantum_router_gateway:
|
||||||
login_tenant_name=admin router_name=external_router
|
state: present
|
||||||
network_name=external_network
|
login_username: admin
|
||||||
|
login_password: admin
|
||||||
|
login_tenant_name: admin
|
||||||
|
router_name: external_router
|
||||||
|
network_name: external_network
|
||||||
'''
|
'''
|
||||||
|
|
||||||
_os_keystone = None
|
_os_keystone = None
|
||||||
|
|
|
@ -83,13 +83,15 @@ requirements: ["quantumclient", "keystoneclient"]
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Attach tenant1's subnet to the external router
|
- name: "Attach tenant1's subnet to the external router"
|
||||||
- quantum_router_interface: state=present login_username=admin
|
quantum_router_interface:
|
||||||
login_password=admin
|
state: present
|
||||||
login_tenant_name=admin
|
login_username: admin
|
||||||
tenant_name=tenant1
|
login_password: admin
|
||||||
router_name=external_route
|
login_tenant_name: admin
|
||||||
subnet_name=t1subnet
|
tenant_name: tenant1
|
||||||
|
router_name: external_route
|
||||||
|
subnet_name: t1subnet
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -119,10 +119,16 @@ requirements: ["quantumclient", "neutronclient", "keystoneclient"]
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Create a subnet for a tenant with the specified subnet
|
- name: Create a subnet for a tenant with the specified subnet
|
||||||
- quantum_subnet: state=present login_username=admin login_password=admin
|
quantum_subnet:
|
||||||
login_tenant_name=admin tenant_name=tenant1
|
state: present
|
||||||
network_name=network1 name=net1subnet cidr=192.168.0.0/24"
|
login_username: admin
|
||||||
|
login_password: admin
|
||||||
|
login_tenant_name: admin
|
||||||
|
tenant_name: tenant1
|
||||||
|
network_name: network1
|
||||||
|
name: net1subnet
|
||||||
|
cidr: 192.168.0.0/24
|
||||||
'''
|
'''
|
||||||
|
|
||||||
_os_keystone = None
|
_os_keystone = None
|
||||||
|
|
|
@ -83,16 +83,28 @@ author:
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Manage the state of program to be in 'started' state.
|
# Manage the state of program to be in 'started' state.
|
||||||
- supervisorctl: name=my_app state=started
|
- supervisorctl:
|
||||||
|
name: my_app
|
||||||
|
state: started
|
||||||
|
|
||||||
# Manage the state of program group to be in 'started' state.
|
# Manage the state of program group to be in 'started' state.
|
||||||
- supervisorctl: name='my_apps:' state=started
|
- supervisorctl:
|
||||||
|
name: 'my_apps:'
|
||||||
|
state: started
|
||||||
|
|
||||||
# Restart my_app, reading supervisorctl configuration from a specified file.
|
# Restart my_app, reading supervisorctl configuration from a specified file.
|
||||||
- supervisorctl: name=my_app state=restarted config=/var/opt/my_project/supervisord.conf
|
- supervisorctl:
|
||||||
|
name: my_app
|
||||||
|
state: restarted
|
||||||
|
config: /var/opt/my_project/supervisord.conf
|
||||||
|
|
||||||
# Restart my_app, connecting to supervisord with credentials and server URL.
|
# Restart my_app, connecting to supervisord with credentials and server URL.
|
||||||
- supervisorctl: name=my_app state=restarted username=test password=testpass server_url=http://localhost:9001
|
- supervisorctl:
|
||||||
|
name: my_app
|
||||||
|
state: restarted
|
||||||
|
username: test
|
||||||
|
password: testpass
|
||||||
|
server_url: 'http://localhost:9001'
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue