Skip to content

Commit bd83f2c

Browse files
committed
Fixes #304: Update AWS LAMP provisioner.
1 parent d1dbe2f commit bd83f2c

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

lamp-infrastructure/ansible.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ host_key_checking = False
33
roles_path = ./roles
44
nocows = 1
55
retry_files_enabled = False
6+
7+
[ssh_connection]
8+
pipelining = True

lamp-infrastructure/provisioners/aws.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
gather_facts: false
55

66
vars:
7+
# aws_profile: default
8+
# TODO
9+
aws_profile: jeffgeerling
10+
aws_region: us-east-1 # North Virginia
11+
aws_ec2_ami: ami-06cf02a98a61f9f5e # CentOS 7
12+
713
instances:
814
- name: a4d.lamp.varnish
915
group: "lamp_varnish"
@@ -66,10 +72,11 @@
6672
ec2_group:
6773
name: "{{ item.name }}"
6874
description: Example EC2 security group for A4D.
69-
region: "{{ item.region | default('us-west-2') }}" # Oregon
70-
state: present
75+
state: absent
7176
rules: "{{ item.rules }}"
7277
rules_egress: "{{ item.rules_egress }}"
78+
profile: "{{ aws_profile }}"
79+
region: "{{ aws_region }}"
7380
with_items: "{{ security_groups }}"
7481

7582
- name: Provision EC2 instances.
@@ -79,15 +86,16 @@
7986
inventory_group: "{{ item.group | default('') }}"
8087
inventory_host: "{{ item.name | default('') }}"
8188
group: "{{ item.security_group | default('') }}"
82-
instance_type: "{{ item.type | default('t2.micro')}}" # Free
83-
image: "{{ item.image | default('ami-3ecc8f46') }}" # CentOS 7
84-
region: "{{ item.region | default('us-west-2') }}" # Oregon
89+
instance_type: "{{ item.type | default('t2.micro')}}"
90+
image: "{{ aws_ec2_ami }}"
8591
wait: yes
8692
wait_timeout: 500
8793
exact_count: 1
8894
count_tag:
8995
inventory_group: "{{ item.group | default('') }}"
9096
inventory_host: "{{ item.name | default('') }}"
97+
profile: "{{ aws_profile }}"
98+
region: "{{ aws_region }}"
9199
register: created_instances
92100
with_items: "{{ instances }}"
93101

@@ -96,7 +104,8 @@
96104
name: "{{ item.1.tagged_instances.0.public_ip }}"
97105
groups: "aws,{{ item.1.item.group }},{{ item.1.item.name }}"
98106
# You can dynamically add inventory variables per-host.
99-
ansible_user: ec2-user
107+
ansible_user: centos
108+
ansible_ssh_private_key_file: ~/.ssh/lamp_aws.pem
100109
host_key_checking: false
101110
mysql_replication_role: >-
102111
{{ 'master' if (item.1.item.name == 'a4d.lamp.db.1')
@@ -105,14 +114,9 @@
105114
when: item.1.instances is defined
106115
with_indexed_items: "{{ created_instances.results }}"
107116

108-
# Run some general configuration on all AWS hosts.
109117
- hosts: aws
110118
gather_facts: false
111119

112120
tasks:
113-
- name: Wait for port 22 to become available.
114-
local_action: "wait_for port=22 host={{ inventory_hostname }}"
115-
116-
- name: Set selinux into 'permissive' mode.
117-
selinux: policy=targeted state=permissive
118-
become: yes
121+
- name: Wait for host to become available.
122+
wait_for_connection:

0 commit comments

Comments
 (0)