-
Notifications
You must be signed in to change notification settings - Fork 0
/
provision.yml
70 lines (63 loc) · 2.09 KB
/
provision.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
---
- name: Common
hosts:
- servers
- agents
become: True
vars_files:
- vars/env.yml
roles:
- common
- name: Load Balancer | Provision
hosts: loadbalancers
gather_facts: False
become: True
vars:
INTERFACE: eth0
vars_files:
- vars/env.yml
roles:
- load-balancer
- name: Server | Provision
hosts: servers
become: True
vars:
# Use the load balancer IP if it exists, otherwise use the first server IP. Note: VIRTUAL_IP always takes presedence over this.
SERVER_ENDPOINT: "{{ groups['loadbalancers'][0] is defined and hostvars[groups['loadbalancers'][0]].ip or hostvars[groups['servers'][0]].ip }}"
vars:
CERT_MANAGER_VERSION: 'v1.4.0'
ETCD_DOWNLOAD_URL: 'https://storage.googleapis.com/etcd'
ETCD_VERSION: '3.5.0'
K3S_VERSION: 'v1.20.8+k3s1' # Rancher is not supported on v1.21 yet.
RANCHER_VERSION: '2.5.8'
vars_files:
- vars/env.yml
roles:
- server
- name: Agent | Provision
hosts: agents
become: True
vars:
# Use the load balancer IP if it exists, otherwise use the first server IP. Note: VIRTUAL_IP always takes presedence over this.
SERVER_ENDPOINT: "{{ groups['loadbalancers'][0] is defined and hostvars[groups['loadbalancers'][0]].ip or hostvars[groups['servers'][0]].ip }}"
vars_files:
- vars/env.yml
roles:
- agent
- name: Storage | Provision
hosts: storage
become: True
vars:
LONGHORN_VERSION:
roles:
- storage
- name: Finished!
hosts: servers[0]
vars:
# Use the load balancer IP if it exists, otherwise use the first server IP. Note: VIRTUAL_IP always takes presedence over this.
SERVER_ENDPOINT: "{{ groups['loadbalancers'][0] is defined and hostvars[groups['loadbalancers'][0]].ip or hostvars[groups['servers'][0]].ip }}"
vars_files:
- vars/env.yml
tasks:
- debug:
msg: "!! Done. Create a DNS record or /etc/hosts entry for the load balancer / server ({{ VIRTUAL_IP is defined and VIRTUAL_IP or SERVER_ENDPOINT }} -> {{ DNS_NAME }}), then browse to {{ DNS_NAME }} to finish Rancher configuration. Don't forget to source ~/.profile for kubectl access !!"