-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathk8s-gpu-playbook.yml
62 lines (56 loc) · 1.82 KB
/
k8s-gpu-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
---
# This playbook installs kubernete packages and its dependencies for GPU-equipped machines.
# It does not initialize or create a cluster. Use k8s-gpu-cluster-init-playbook to create a
# cluster after k8s packages are installed.
- hosts: all
gather_facts: False
tasks:
- name: install python 2 if not installed
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal python-apt python-pip)
become: true
- name: install nvidia drivers
hosts: gpu
tasks:
- name: install nvidia driver
include_role:
name: nvidia-driver
vars:
nvidia_driver_package: nvidia-396
- name: install docker packages
hosts: k8s-master:k8s-worker
tasks:
- name: uninstall previously installed docker
package:
name: docker-ce
state: absent
become: yes
- include_role:
name: geerlingguy.docker
vars:
docker_package: "docker-ce=17.03.2~ce-0~ubuntu-xenial"
docker_package_state: present
docker_users:
- "{{ ansible_env.USER }}"
ansible_become: yes
when: ("ansible_distribution == 'Ubuntu'") and ("ansible_distribution_release == 'xenial'")
- name: install nvidia-docker
hosts: gpu
tasks:
- include_role:
name: nvidia-docker
vars:
nvidia_container_runtime_package: nvidia-container-runtime=2.0.0+docker17.03.2-1
nvidia_docker_package: nvidia-docker2=2.0.3+docker17.03.2-1
ansible_become: yes
when: "ansible_distribution == 'Ubuntu'"
- name: install k8s
hosts: k8s-master:k8s-worker
tasks:
- include_role:
name: k8s
vars:
kubelet_package: kubelet=1.11.1-00
kubeadm_package: kubeadm=1.11.1-00
kubectl_package: kubectl=1.11.1-00
ansible_become: yes
when: "ansible_distribution == 'Ubuntu'"