Created
May 28, 2015 14:43
-
-
Save jameswnl/f306f3a88a6d86114ff4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: localhost | |
name: Provision play | |
connection: local | |
gather_facts: False | |
vars: | |
- ami_id: ami-78fc7410 | |
- key_name: operations | |
- username: jameswong | |
tasks: | |
- name: Provision a set of instances | |
ec2: | |
key_name: "{{ key_name }}" | |
group: default | |
instance_type: t1.micro | |
image: "{{ ami_id }}" | |
region: us-east-1 | |
wait: true | |
exact_count: 2 | |
count_tag: | |
Name: "{{ username }}_Demo" | |
instance_tags: | |
Name: "{{ username }}_Demo" | |
register: ec2 | |
- name: Add all instance public IPs to host group | |
add_host: hostname={{ item.public_ip }} groups=ec2hosts | |
with_items: ec2.instances | |
- pause: minutes=5 | |
tags: | |
- provision | |
- hosts: ec2hosts | |
name: Configuration play | |
user: root | |
gather_facts: true | |
tasks: | |
- name: Install NTP | |
yum: pkg={{item}} state=installed | |
with_items: | |
- ntp | |
- ntpdate | |
- ntp-doc | |
tags: | |
- install-ntp | |
- name: Check NTP service | |
service: name=ntpd state=started | |
tags: | |
- start-ntpd | |
tags: | |
- config | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment