-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_db.yaml
69 lines (60 loc) · 1.55 KB
/
create_db.yaml
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
- hosts: localhost
gather_facts: no
vars:
aws_region: "us-west-1"
module_defaults:
group/aws:
region: "{{ aws_region }}"
tasks:
- name: Create rds subnet
rds_subnet_group:
state: present
name: ans-rds-subnet
description: private subnet for ansible rds
subnets:
- "{{private_subnet_1.subnet.id}}"
- "{{private_subnet_2.subnet.id}}"
register: rds_sng
- name: Create db
rds:
command: create
db_name: image_gallery
instance_name: imagegallery
instance_type: db.t2.micro
size: '10'
db_engine: postgres
region: "{{ aws_region }}"
zone: "{{ aws_region + 'a' }}"
subnet: ans-rds-subnet
vpc_security_groups: "{{postgres_sg.group_id}}"
username: postgres
password: postgres
# wait: yes
tags:
name: ansible_db
register: ans_rds
- name: debug
debug: var=ans_rds
#
# - name: Add sql params
# blockinfile:
# path: /ec2-scripts/ec2_db_provisions.sh
# block: |
# x
# state: present
#
# - name: Changing perm of "/ec2_b_provisions.sh", adding "+x"
# file: dest=/ec2-scripts/ec2_db_provisions.sh mode=x
#
# - name: Copy rds enpoint
# local_action:
# module: copy
# content: "{{ ans_rds.instance.endpoint }}"
# dest: rds-ep.txt
#
# - name: Copy rds name
# local_action:
# module: copy
# content: "{{ ans_rds.instance.db_name }}"
# dest: rds-name.txt
#