-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathplaybook.yml
88 lines (77 loc) · 2.52 KB
/
playbook.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
- hosts: localhost
connection: local
tasks:
- name: Creating LXD container
lxd_container:
name: "{{ item }}"
state: started
config:
limits.cpu: "2"
limits.memory: 4GB
limits.memory.swap: "false"
linux.kernel_modules: ip_tables,ip6_tables,netlink_diag,nf_nat,overlay
raw.lxc: "lxc.apparmor.profile=unconfined\nlxc.cap.drop= \nlxc.cgroup.devices.allow=a\nlxc.mount.auto=proc:rw sys:rw"
security.nesting: "true"
security.privileged: "true"
source:
type: image
mode: pull
server: https://images.linuxcontainers.org
protocol: simplestreams
alias: centos/7/amd64
profiles: ["default"]
wait_for_ipv4_addresses: true
timeout: 600
with_items:
- k8s-master
- k8s-node-1
- k8s-node-2
- k8s-node-3
- name: Initializing the Kubernetes cluster
delegate_to: "{{ item }}"
script: scripts/k8s.sh
with_items:
- k8s-master
- k8s-node-1
- k8s-node-2
- k8s-node-3
- name: Copy k8s admin.conf to ~/.kube/config
delegate_to: localhost
shell: lxc file pull k8s-master/etc/kubernetes/admin.conf ~/.kube/config
- name: Install Yum packages
delegate_to: k8s-master
yum:
name: "{{ packages }}"
state: present
update_cache: yes
vars:
packages:
- openssl
- name: Deploy Kubernetes Dashboard
delegate_to: localhost
shell: kubectl apply -f dashboard.yml
- name: Grant full admin privileges to Dashboard's Service Account
delegate_to: localhost
shell: kubectl apply -f authentication.yml
- name: Get Helm manifest
delegate_to: k8s-master
get_url:
url: https://raw.githubusercontent.com/helm/helm/master/scripts/get
dest: ./get.helm.sh
- name: Install Helm
delegate_to: k8s-master
shell: bash ./get.helm.sh
- name: Remove Helm manifest
delegate_to: k8s-master
file:
path: ./get.helm.sh
state: absent
- name: Create Helm ServiceAccount
delegate_to: k8s-master
shell: kubectl create serviceaccount tiller --namespace=kube-system
- name: Create Helm Roles
delegate_to: k8s-master
shell: kubectl create clusterrolebinding tiller-admin --serviceaccount=kube-system:tiller --clusterrole=cluster-admin
- name: Init helm
delegate_to: k8s-master
shell: helm init --service-account=tiller