-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdbservers.yml
58 lines (56 loc) · 1.64 KB
/
dbservers.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
---
- hosts: localhost
connection: local
gather_facts: no
environment:
AWS_ACCESS_KEY_ID: "{{ aws_access_key_id }}"
AWS_SECRET_ACCESS_KEY: "{{ aws_secret_access_key }}"
AWS_REGION: "{{ AWS_REGION }}"
vars_files:
- keys
tasks:
- name: Get VPC information
include_role:
name: vpc
vars:
fetch_vpc_info: True
when: hostvars['localhost']['create_initial_vpc'] is not defined
- hosts: database
become: true
vars_files:
- keys
vars:
ansible_ssh_common_args: "-o ProxyCommand='ssh -o StrictHostKeyChecking=no -i {{ private_key_location }} -W %h:%p -q ubuntu@{{ hostvars['localhost']['bastion_ip'] }}'"
tasks:
- name: Patch database hosts
include_role:
name: patching
when: hostvars['localhost']['create_initial_vpc'] is defined
- name: Install common packages
include_role:
name: common
when: hostvars['localhost']['create_initial_vpc'] is defined
- name: Configure database servers
include_role:
name: mysql
vars:
configure_database_host: True
when: hostvars['localhost']['create_initial_vpc'] is defined
- hosts: database
become: true
environment:
AWS_ACCESS_KEY_ID: "{{ aws_access_key_id }}"
AWS_SECRET_ACCESS_KEY: "{{ aws_secret_access_key }}"
AWS_REGION: "{{ AWS_REGION }}"
vars_files:
- keys
tasks:
- name: Make sure common packages are installed
include_role:
name: common
- name: Configure database
include_role:
name: mysql
vars:
configure_database_host: True
when: hostvars['localhost']['create_initial_vpc'] is not defined