2018-05-09 16:19:11 +02:00
|
|
|
---
|
|
|
|
- name: Ensure dependencies are installed.
|
|
|
|
apt:
|
2018-09-28 05:17:50 +02:00
|
|
|
name:
|
|
|
|
- apt-transport-https
|
|
|
|
- ca-certificates
|
2018-05-09 16:19:11 +02:00
|
|
|
state: present
|
|
|
|
|
2023-11-07 04:00:59 +01:00
|
|
|
- name: Prepare apt keyring directory.
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "{{ kubernetes_apt_keyring_file | dirname }}"
|
|
|
|
state: directory
|
|
|
|
mode: 0755
|
|
|
|
|
|
|
|
- name: Get Kubernetes apt key.
|
2023-11-07 15:11:01 +01:00
|
|
|
ansible.builtin.get_url:
|
|
|
|
url: "https://pkgs.k8s.io/core:/{{ kubernetes_apt_release_channel }}:/v{{ kubernetes_version }}/deb/Release.key"
|
|
|
|
dest: "{{ kubernetes_apt_keyring_file }}"
|
|
|
|
mode: '0644'
|
|
|
|
force: true
|
2023-11-07 04:00:59 +01:00
|
|
|
|
|
|
|
- name: Be sure deprecated Kubernetes repository is absent.
|
|
|
|
file:
|
|
|
|
path: "/etc/apt/sources.list.d/apt_kubernetes_io.list"
|
|
|
|
state: absent
|
2018-05-09 16:19:11 +02:00
|
|
|
|
|
|
|
- name: Add Kubernetes repository.
|
2023-11-07 04:00:59 +01:00
|
|
|
ansible.builtin.apt_repository:
|
2023-11-07 15:11:01 +01:00
|
|
|
repo: "{{ kubernetes_apt_repository }}"
|
2023-11-07 04:00:59 +01:00
|
|
|
filename: pkgs_k8s_io
|
2018-05-09 16:19:11 +02:00
|
|
|
state: present
|
2018-09-28 06:30:25 +02:00
|
|
|
update_cache: true
|
2018-09-28 06:19:56 +02:00
|
|
|
|
|
|
|
- name: Add Kubernetes apt preferences file to pin a version.
|
|
|
|
template:
|
|
|
|
src: apt-preferences-kubernetes.j2
|
|
|
|
dest: /etc/apt/preferences.d/kubernetes
|
2020-08-20 19:23:45 +02:00
|
|
|
mode: 0644
|