Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ansible/ansible-examples.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Gerla <tim@gerla.net>2013-12-12 23:30:42 +0400
committerTim Gerla <tim@gerla.net>2013-12-12 23:30:42 +0400
commitbfa2f1cd2b646aa1af04102bde9b7934904d939e (patch)
tree74ff4001d966dfe2e406d45f5bc8fdabd0a579af /language_features
parent93c899a287baabc335f5fe7ddf7511bc74c26262 (diff)
Modernize action calls and clean comments a bit
Diffstat (limited to 'language_features')
-rw-r--r--language_features/eucalyptus-ec2.yml32
1 files changed, 20 insertions, 12 deletions
diff --git a/language_features/eucalyptus-ec2.yml b/language_features/eucalyptus-ec2.yml
index 0712196..1d38dbb 100644
--- a/language_features/eucalyptus-ec2.yml
+++ b/language_features/eucalyptus-ec2.yml
@@ -1,10 +1,16 @@
---
-# This playbook is an example for deploying multiple instances into EC2/Euca and "doing something" with them.
-# - uses the ec2 and ec2_vol module.
+# This playbook is an example for deploying multiple instances into
+# EC2/Euca and "doing something" with them.
+#
+# - uses the ec2 and ec2_vol module.
#
-# Run this with ansible-playbook and supply the private key for your EC2/Euca user (to access the instance in the second play), e.g:
+# Run this with ansible-playbook and supply the private key for your
+# EC2/Euca user (to access the instance in the second play), e.g:
+#
# ansible-playbook eucalyptus-ec2-deploy.yml -v --private-key=/path/to/ec2/pri/key
+#
+# The play operates on the local (Ansible control) machine.
- name: Stage instance(s)
hosts: local
connection: local
@@ -21,37 +27,39 @@
tasks:
- name: Launch instance
- local_action: ec2 keypair={{keypair}} group={{security_group}} instance_type={{instance_type}} image={{image}} wait=true count=5
+ ec2: keypair={{keypair}} group={{security_group}}
+ instance_type={{instance_type}} image={{image}}
+ wait=true count=5
register: ec2
# Use with_items to add each instances public IP to a new hostgroup for use in the next play.
- name: Add new instances to host group
- local_action: add_host hostname={{item.public_ip}} groupname=deploy
+ add_host: hostname={{item.public_ip}} groupname=deploy
with_items: ec2.instances
- name: Wait for the instances to boot by checking the ssh port
- local_action: wait_for host={{item.public_dns_name}} port=22 delay=60 timeout=320 state=started
+ wait_for: host={{item.public_dns_name}} port=22 delay=60 timeout=320 state=started
with_items: ec2.instances
- # Use the ec2_vol module to create volumes for attachment to each instance. Use with_items to attach to each instance (by returned id) launched previously.
+ # Use the ec2_vol module to create volumes for attachment to each instance.
+ # Use with_items to attach to each instance (by returned id) launched previously.
- name: Create a volume and attach
- local_action: ec2_vol volume_size=20 instance={{item.id}}
+ ec2_vol: volume_size=20 instance={{item.id}}
with_items: ec2.instances
-# This play targets the new host group
+# This play targets the new host group
- name: Configure instance
hosts: deploy
user: root
- gather_facts: True
# Do some stuff on each instance ....
tasks:
- name: Ensure NTP is up and running
- action: service name=ntpd state=started
+ service: name=ntpd state=started
- name: Install Apache Web Server
- action: yum pkg=httpd state=latest
+ yum: pkg=httpd state=latest