-
Notifications
You must be signed in to change notification settings - Fork 6
/
stack-wordpress.yml
51 lines (48 loc) · 1.54 KB
/
stack-wordpress.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
- name: Provisioning Baking Server
# Baking server is the template for the AMI that will be used in
# the CloudFormation stack
hosts: localhost
connection: local
gather_facts: false
roles:
- provision-ec2
- name: Configuring Baking Server
# Playbooks are copied into baking server and are run
# by server's userdata upon first boot
hosts: wordpress-bake
sudo: yes
gather_facts: false
tasks:
- name: Upload local playbooks
copy: src=local_wordpress/ansible dest=/etc
- hosts: localhost
connection: local
gather_facts: false
tasks:
- name: Registering new AMI from baking server
ec2_ami:
instance_id: "{{ ec2.instances[0].id }}"
region: "{{ region }}"
wait: yes
no_reboot: yes
name: "wordpress-{{ version }}"
description: "wordpress-{{ version }}"
register: ami
- name: Creating/Updating Stack with latest AMI
cloudformation:
stack_name: "{{ stack_name }}"
state: "present"
region: "{{ region }}"
disable_rollback: true
template: "cloudformation/wordpress.json"
template_parameters:
KeyName: "{{ cf_keypair }}"
InstanceType: "{{ cf_instance_type }}"
DBClass: "{{ rds_class }}"
SSHLocation: "0.0.0.0/0"
DBPassword: "{{ rds_password }}"
DBAllocatedStorage: "{{ rds_storage_size }}"
AMIId: "{{ ami.image_id }}"
VPCId: "{{ vpc_id }}"
SubnetIds: "{{ cf_subnet_ids|join(',') }}"