-
Notifications
You must be signed in to change notification settings - Fork 1
/
vm-deploy.yml
101 lines (95 loc) · 2.92 KB
/
vm-deploy.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
- name: create deployment
hosts: localhost
connection: local
gather_facts: false
vars_files:
- "vm_vars/credentials.yaml"
- "vm_vars/settings.yaml"
tasks:
- name: vlan creation
gandi_vlan:
gandi_api_key: "{{ gandi_api_key }}"
name: "{{ vlan_name }}"
datacenter: "{{ datacenter }}"
gateway: "{{ bastion_ip }}"
subnet: "{{ vlan_net }}"
tags: vlan
- name: bastion creation
gandi_vps:
gandi_api_key: "{{ gandi_api_key }}"
name: bastion
machine_type: custom
image: "{{ image }}"
datacenter: "{{ datacenter }}"
sshkey_ids:
- "{{ gandi_ssh_key_id }}"
cores: "{{ bastion_cores }}"
memory: "{{ bastion_memory }}"
disk: "{{ bastion_disk }}"
interfaces: {'publics': [{'ipv4': 'auto'}], 'privates': [{'vlan': "{{ vlan_name }}", 'ipv4': "{{ bastion_ip }}"}]}
state: running
farm: bastion_node
tags: bastion
async: 7200
poll: 0
register: bastion_creation
- name: master creation
gandi_vps:
gandi_api_key: "{{ gandi_api_key }}"
name: "{{ item.name }}"
machine_type: custom
image: "{{ image }}"
datacenter: "{{ datacenter }}"
sshkey_ids:
- "{{ gandi_ssh_key_id }}"
cores: "{{ node_cpu }}"
memory: "{{ node_mem }}"
disk: "{{ node_disk }}"
interfaces: {'privates': [{'vlan': "{{ vlan_name }}", 'ipv4': "{{ item.master_ip }}"}]}
state: running
farm: master_node
with_items:
- { name: master, master_ip: "{{ master_ip }}" }
tags:
- master
- kube_cluster
async: 7200
poll: 0
register: master_creation
- name: nodes creation
gandi_vps:
gandi_api_key: "{{ gandi_api_key }}"
name: "{{ item.name }}"
image: "{{ image }}"
machine_type: custom
datacenter: "{{ datacenter }}"
sshkey_ids:
- "{{ gandi_ssh_key_id }}"
cores: "{{ node_cpu }}"
memory: "{{ node_mem }}"
disk: "{{ node_disk }}"
extra_disks: [{'name': "{{ item.db_disk }}", 'size': "{{ cassandra_disk }}"}, {'name': "{{ item.index_disk }}", 'size': "{{ elasticsearch_disk }}"}, {'name': "{{ item.store_disk }}", 'size': "{{ minio_disk }}"}]
interfaces: {'privates': ['vlan': "{{ vlan_name }}"]}
state: running
farm: worker_node
with_items:
- { name: node0, db_disk: db0, index_disk: index0, store_disk: store0 }
- { name: node1, db_disk: db1, index_disk: index1, store_disk: store1 }
- { name: node2, db_disk: db2, index_disk: index2, store_disk: store2 }
tags:
- worker
- kube_cluster
async: 7200
poll: 0
register: worker_creation
- name: wait for creation
async_status:
jid: "{{ item.ansible_job_id }}"
register: jobs
until: jobs.finished
delay: 10
retries: 300
with_items:
- "{{ bastion_creation.results }}"
- "{{ master_creation.results }}"
- "{{ worker_creation.results }}"