-
Notifications
You must be signed in to change notification settings - Fork 10
/
install-cn-basics.yaml
108 lines (92 loc) · 3.2 KB
/
install-cn-basics.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
108
---
- name: Install docker, kubectl and helm
hosts: all
gather_facts: false
tasks:
- name: Install docker
# https://docs.docker.com/engine/install/ubuntu/
block:
- name: Download convinience script
shell: echo $PWD && curl -fsSL https://get.docker.com -o get-docker.sh
- name: Run convinience script
become: true
shell: sh get-docker.sh
- name: Delete convinience script
file:
path: get-docker.sh
state: absent
- name: Adding existing user "{{ ansible_user }}" to group docker
become: true
user:
name: "{{ ansible_user }}"
groups: docker
append: yes
# maybe not needed
- name: "Edit grub file to allow cgroup to set memory"
become: true
lineinfile:
path: "/etc/default/grub"
regexp: '^GRUB_CMDLINE_LINUX=(.*)$'
line: 'GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"'
backrefs: yes
# maybe not needed
- name: Update grub
become: true
shell: update-grub
- name: Reset ssh connection to allow user changes to affect ansible user
meta:
reset_connection
- name: Install kubectl
# https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/
block:
- name: Install Prerequisits
become: true
apt:
update_cache: yes
pkg:
- apt-transport-https
- curl
- ca-certificates
- gnupg
- name: Create keyrings dir if it doesnt exist
become: true
ansible.builtin.file:
path: /etc/apt/keyrings
state: directory
mode: '0755'
- name: Download the public signing key for the Kubernetes package repositories
become: true
shell: curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key | gpg --batch --yes --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg && chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg
- name: Add the Kubernetes apt repository
become: true
shell: echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.30/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list && chmod 644 /etc/apt/sources.list.d/kubernetes.list
- name: Install kubectl
become: true
apt:
update_cache: yes
pkg:
- kubectl
- name: Install helm
# https://helm.sh/docs/intro/install/
block:
- name: Add repo key
become: true
shell: curl https://baltocdn.com/helm/signing.asc | apt-key add -
- name: Install Prerequisits
become: true
apt:
update_cache: yes
pkg:
- apt-transport-https
- name: Add repository
become: true
shell: echo "deb https://baltocdn.com/helm/stable/debian/ all main" | tee /etc/apt/sources.list.d/helm-stable-debian.list
- name: Install helm
become: true
apt:
update_cache: yes
pkg:
- helm
- name: Unconditionally reboot the machine with all defaults
become: true
reboot: