forked from markramach/ansible-kubernetes-playbooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclc-kubernetes-full-plus-apps.yml
86 lines (76 loc) · 2.51 KB
/
clc-kubernetes-full-plus-apps.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
tasks:
- name: Generate server root password.
command: openssl rand -base64 15
register: server_pass
- name: Set server password fact.
set_fact:
server_pass: "{{ server_pass.stdout }}"
- name: Create group if needed.
clc_group:
name: "{{ group }}"
location: "{{ datacenter }}"
state: present
- name: Create new kubernetes server for master deployment.
clc_server:
name: "K8SM"
location: "{{ datacenter }}"
template: ubuntu-14-64
password: "{{ server_pass }}"
count: 1
group: "{{ group }}"
network_id: "{{ network_id }}"
cpu: 2
memory: 4
type: standard
storage_type: standard
register: new_inv_master
- name: Add new servers to in-memory inventory.
add_host:
name={{ item.name }}
ansible_ssh_host={{ item.ipaddress }}
ansible_ssh_user=root
ansible_ssh_pass={{ server_pass }}
etcd_endpoint=http://{{ item.ipaddress }}:4001
apiserver_endpoint=http://{{ item.ipaddress }}:8080
groups=master
with_items: new_inv_master.servers
- name: Set playbook facts.
set_fact:
master_ip: "{{ item.ipaddress }}"
with_items: new_inv_master.servers
- debug: msg="{{ master_ip }}"
- name: Create new kubernetes server for node deployment.
clc_server:
name: "K8SN"
location: "{{ datacenter }}"
template: ubuntu-14-64
password: "{{ server_pass }}"
count: 1
group: "{{ group }}"
network_id: "{{ network_id }}"
cpu: 4
memory: 8
type: standard
storage_type: standard
register: new_inv_node
- name: Add new servers to in-memory inventory.
add_host:
name={{ item.name }}
ansible_ssh_host={{ item.ipaddress }}
ansible_ssh_user=root
ansible_ssh_pass={{ server_pass }}
etcd_endpoint=http://{{ master_ip }}:4001
apiserver_endpoint=http://{{ master_ip }}:8080
groups=node
with_items: new_inv_node.servers
- name: Wait for SSH services be vailable on hosts.
command: sleep 30
- include: kubernetes-master.yml
- include: kubernetes-node.yml
- include: kubernetes-app-wordpress.yml
- include: kubernetes-app-rocket-chat.yml
- include: kubernetes-app-ghost.yml
- include: kubernetes-app-jenkins.yml
- include: kubernetes-app-joomla.yml
- include: kubernetes-app-mysql.yml