-
Notifications
You must be signed in to change notification settings - Fork 7
/
droplets.yml
86 lines (78 loc) · 2.06 KB
/
droplets.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
---
- hosts: localhost
connection: local
gather_facts: false
# Create Load Balancer droplets
tasks:
- name: Create Load Balancer Droplet
digital_ocean:
state: present
command: droplet
name: lb1
private_networking: yes
size_id: 66
image_id: 13089493
region_id: 7
ssh_key_ids: 430781
unique_name: yes
wait_timeout: 600
register: lb1
- name: Add Load Balancer to the Inventory.
add_host:
ansible_ssh_host: "{{ lb1.droplet.ip_address }}"
ansible_ssh_port: 22
name: lb1
groups: lbs, all_droplets
when: lb1.droplet is defined
# Create Application backend droplets
# app1
- name: Create Application server
digital_ocean:
state: present
command: droplet
name: app1
private_networking: yes
size_id: 66
image_id: 13089493
region_id: 7
ssh_key_ids: 430781
unique_name: yes
wait_timeout: 600
register: app1
- name: Add App Server to the Inventory.
add_host:
ansible_ssh_host: "{{ app1.droplet.ip_address }}"
ansible_ssh_port: 22
name: app1
groups: apps, all_droplets
when: app1.droplet is defined
# Create Database servers backend
- name: Create Database servers
digital_ocean:
state: present
command: droplet
name: db1
private_networking: yes
size_id: 66
image_id: 13089493
region_id: 7
ssh_key_ids: 430781
unique_name: yes
wait_timeout: 600
register: db1
- name: Add Database Server to the Inventory.
add_host:
ansible_ssh_host: "{{ db1.droplet.ip_address }}"
ansible_ssh_port: 22
name: db1
groups: dbs, all_droplets
when: db1.droplet is defined
with_items: dbs_droplets
- hosts:
- lbs
- dbs
- apps
remote_user: root
tasks:
- name: Wait for port 22 to become available.
local_action: "wait_for port=22 host={{ ansible_eth0.ipv4.address }}"