forked from openaustralia/infrastructure
-
Notifications
You must be signed in to change notification settings - Fork 0
/
site.yml
101 lines (82 loc) · 2.29 KB
/
site.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Run this like so:
# ansible-playbook -i ec2-hosts site.yml
# To only run this for planningalerts:
# ansible-playbook -i ec2-hosts site.yml -l planningalerts
# To only run this for openaustralia:
# ansible-playbook -i ec2-hosts site.yml -l openaustralia
# To show the value of an encrypted variable:
# ansible planningalerts -i ec2-hosts -m debug -a 'var=planningalerts_production_mysql_password'
# Use terraform (see terraform directory) to actually provision ec2 infrastructure
# Ubuntu 16.04 LTS doesn't come with python pre-installed. We need that for
# Ansible to work (for the gather facts). So install python first
- hosts: all
become: true
gather_facts: False
tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
changed_when: False
- hosts: ec2
become: true
tasks:
- name: Install pip
apt: pkg=python-pip
- name: Install boto which is required for EC2 stuff
pip: name=boto
- name: Get information about the RDS instance
rds:
aws_access_key: "{{ aws_access_key }}"
aws_secret_key: "{{ aws_secret_key }}"
command: facts
instance_name: main-database
region: "{{ ec2_region }}"
register: rds_mysql
# Run this task even when running ansible-playbook with "--check"
check_mode: no
- name: Get information about the postgresql RDS instance
rds:
aws_access_key: "{{ aws_access_key }}"
aws_secret_key: "{{ aws_secret_key }}"
command: facts
instance_name: postgresql
region: "{{ ec2_region }}"
register: rds_postgresql
# Run this task even when running ansible-playbook with "--check"
check_mode: no
- hosts: mysql
become: true
roles:
- mysql
- hosts: postgresql
become: true
roles:
- postgresql
- hosts: righttoknow
become: true
roles:
- righttoknow
- hosts: planningalerts
become: true
roles:
- corelogic
- planningalerts
- hosts: electionleaflets
become: true
roles:
- electionleaflets
- hosts: theyvoteforyou
become: true
roles:
- theyvoteforyou
- hosts: oaf
become: true
roles:
- oaf
- hosts: openaustralia
become: true
roles:
- openaustralia
- hosts: opengovernment
become: true
roles:
- opengovernment