Skip to content

Commit

Permalink
ansible support for k8s v1.22+
Browse files Browse the repository at this point in the history
  • Loading branch information
dilallkx committed Nov 7, 2022
1 parent e99b4de commit 76894f8
Show file tree
Hide file tree
Showing 10 changed files with 501 additions and 37 deletions.
21 changes: 15 additions & 6 deletions playbooks/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,33 @@
# ansible_user: root
ansible_python_interpreter: /usr/bin/python3

# Ubuntu
ubuntu_dist: "Ubuntu"
ubuntu_release: "bionic"
ubuntu_dist_major: "18"
ubuntu_dist_version: "18.04"

# Docker
docker_version: "5:19.03"
docker_version: "5:20.10"

# Containerd
containerd_version: "1.5.11-1"

# Kubernetes
kube_version: "1.19"
kube_version: "1.24"
cni_version: "0.8.7"
master_ip: "{{ hostvars[groups['master'][0]]['ansible_default_ipv4'].address | default(groups['master'][0]) }}"
network_dir: /etc/kubernetes/network
kubeadmin_config: /etc/kubernetes/admin.conf

# Helm
helm_version: "3.3/stable"
helm_version: "3.7/stable"

# Go
go_version: "1.15.3"
golangci_lint_version: "v1.18.0"
go_version: "1.18.1"
golangci_lint_version: "v1.46.0"

# Node and NPM
node_version: "10.16.3"
node_version: "12.19.0"
npm_version: "6.14.8"
eslint_version: "5.16.0"
33 changes: 26 additions & 7 deletions playbooks/roles/docker/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
- apt-transport-https
- ca-certificates
- curl
- gnupg
- lsb-release
- software-properties-common
- python3-pip
- virtualenv
Expand All @@ -28,19 +30,29 @@

- name: Add Docker APT repository
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu bionic stable
repo: deb https://download.docker.com/linux/ubuntu {{ ubuntu_release }} stable
state: present

- name: Install docker engine
apt:
update_cache: yes
name: "docker-ce={{ docker_version }}*"
name: "{{ item }}"
state: present
with_items:
- docker-ce={{ docker_version }}*
- docker-ce-cli={{ docker_version }}*
- containerd.io={{ containerd_version }}
- docker-compose-plugin

# - name: Hold docker version
# dpkg_selections:
# name: docker-ce
# selection: hold
- name: Hold docker version
dpkg_selections:
name: "{{ item }}"
selection: hold
with_items:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-compose-plugin

- name: Verify docker group is present
group:
Expand All @@ -53,6 +65,13 @@
append: yes
groups: docker

- name: Allow {{ ansible_user }} to access containerd socket
acl:
path: /run/containerd/containerd.sock
etype: user
entity: '{{ ansible_user }}'
permissions: rw

- name: Set dockerd config
copy:
src: "daemon.json"
Expand All @@ -72,4 +91,4 @@
daemon_reload: yes
state: started
enabled: yes
register: started_docker
register: started_docker
8 changes: 4 additions & 4 deletions playbooks/roles/docker/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
- name: Assert OS is Ubuntu 18.04
assert:
that:
- ansible_distribution == 'Ubuntu'
- ansible_distribution_major_version == '18'
- ansible_distribution_version == '18.04'
- ansible_distribution == "{{ ubuntu_dist }}"
- ansible_distribution_major_version == "{{ ubuntu_dist_major }}"
- ansible_distribution_version == "{{ ubuntu_dist_version }}"
quiet: yes

- name: Gather package facts
Expand All @@ -21,7 +21,7 @@
- name: Assert currently installed Docker version is supported
assert:
that:
- installed_docker_version is match("5:19.03*")
- installed_docker_version is match("{{ docker_version }}*")
quiet: yes
when:
- installed_docker_version is defined
Expand Down
Loading

0 comments on commit 76894f8

Please sign in to comment.