forked from infraly/k8s-on-openstack
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsite.yaml
107 lines (95 loc) · 2.19 KB
/
site.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
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
102
103
104
105
106
107
---
- name: Launch k8s master
hosts: localhost
pre_tasks:
- name: create network
os_network:
name: "{{ lookup('env','NAME') | default('k8s', true) }}"
- name: create subnet
os_subnet:
network_name: "{{ lookup('env','NAME') | default('k8s', true) }}"
name: "{{ lookup('env','NAME') | default('k8s', true) }}"
cidr: 10.8.10.0/24
dns_nameservers:
- 8.8.8.8
- 8.8.4.4
register: subnet
- name: create router
os_router:
name: "{{ lookup('env','NAME') | default('k8s', true) }}"
network: "{{ lookup('env', 'EXTERNAL_NETWORK') | default('public', true) }}"
interfaces:
- "{{ lookup('env','NAME') | default('k8s', true) }}"
register: router
- name: Set variables
set_fact:
name: "{{ lookup('env','NAME') | default('k8s', true) }}"
state: present
node_count: "{{ lookup('env', 'NODE_COUNT') | default(3, true) }}"
routeruuid: "{{ router.id }}"
subnetuuid: "{{ subnet.id }}"
roles:
- openstack-security-groups
- openstack-master
- name: Master preparation
hosts: master
pre_tasks:
- name: Set variables
set_fact:
name: "{{ lookup('env','NAME') | default('k8s', true) }}"
state: present
tags:
- bootstrap
gather_facts: false
roles:
- common
- name: Launch k8s nodes
hosts: localhost
roles:
- openstack-nodes
- name: Nodes preparation
hosts: nodes
pre_tasks:
- name: Set variables
set_fact:
name: "{{ lookup('env','NAME') | default('k8s', true) }}"
tags:
- bootstrap
gather_facts: false
roles:
- common
- name: Install repo and packages
hosts: all
tags:
- bootstrap
become: true
roles:
- kubeadm
- name: k8s master setup
hosts: master
tags:
- bootstrap
become: true
roles:
- kubeadm-master
- name: k8s nodes setup
hosts: nodes
become: true
tags:
- bootstrap
roles:
- kubeadm-nodes
- name: k8s addons
hosts: master
tags:
- bootstrap
roles:
- k8s-addons
- name: Health check
hosts: master
roles:
- healthcheck
- name: Local kubectl configuration
hosts: master
roles:
- kubectl