-
Notifications
You must be signed in to change notification settings - Fork 0
/
ansible-playbook-k8s.yml
87 lines (87 loc) · 2.47 KB
/
ansible-playbook-k8s.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
# This playbook installs apps and packages needed for working with Kubernetes
- hosts: localhost
pre_tasks:
- name: Make .bin directory
file:
path: ~/.bin
state: directory
tasks:
- name: Add Docker's GPG key
become: yes
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Add Docker repository
become: yes
shell: add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
changed_when: false
- name: Install Docker
become: yes
shell: apt install -y docker-ce docker-ce-cli containerd.io
register: result
changed_when: result.stdout is not search("0 newly installed")
- name: Create a Docker user group
become: yes
group:
name: docker
state: present
- name: Add {{ ansible_user_id }} to the docker group
become: yes
user:
name: '{{ ansible_user_id }}'
groups: docker
append: yes
- name: Start the docker service
become: yes
service:
name: docker
state: started
- name: Install cfssl
homebrew:
name: cfssl
state: present
- name: Install k3d
homebrew:
name: k3d
state: present
- name: Install kubectl
homebrew:
name: kubectl
state: present
- name: Install snap
become: yes
shell: apt install -y snap
register: result
changed_when: result.stdout is not search("0 newly installed")
- name: Install microk8s via snap
become: yes
snap:
name: microk8s
state: present
classic: yes
- name: Start microk8s services
become: yes
shell: microk8s.enable dns dashboard registry
changed_when: false
- name: Install kustomize
homebrew:
name: kustomize
state: present
- name: Install controller-gen
shell: GO111MODULE=on go get "sigs.k8s.io/controller-tools/cmd/[email protected]"
changed_when: false
- name: Install fluxctl
homebrew:
name: fluxctl
state: present
- name: Install kind
homebrew:
name: kind
state: present
- name: Install Kubebuilder
shell: |
os=$(go env GOOS)
arch=$(go env GOARCH)
curl -L https://go.kubebuilder.io/dl/2.3.1/${os}/${arch} | tar -xz -C /tmp/
mv /tmp/kubebuilder_2.3.1_${os}_${arch}/bin/* ~/.bin
changed_when: false