mirror of
https://github.com/geerlingguy/ansible-role-kubernetes.git
synced 2024-11-18 19:10:39 +01:00
37 lines
1.1 KiB
YAML
37 lines
1.1 KiB
YAML
---
|
|
- name: Ensure dependencies are installed.
|
|
apt:
|
|
name:
|
|
- apt-transport-https
|
|
- ca-certificates
|
|
state: present
|
|
|
|
- name: Prepare apt keyring directory.
|
|
ansible.builtin.file:
|
|
path: "{{ kubernetes_apt_keyring_file | dirname }}"
|
|
state: directory
|
|
mode: 0755
|
|
|
|
- name: Get Kubernetes apt key.
|
|
shell: "curl -fsSL https://pkgs.k8s.io/core:/{{ kubernetes_apt_release_channel }}:/v{{ kubernetes_version }}/deb/Release.key | gpg --dearmor -o {{ kubernetes_apt_keyring_file }}"
|
|
args:
|
|
creates: "{{ kubernetes_apt_keyring_file }}"
|
|
|
|
- name: Be sure deprecated Kubernetes repository is absent.
|
|
file:
|
|
path: "/etc/apt/sources.list.d/apt_kubernetes_io.list"
|
|
state: absent
|
|
|
|
- name: Add Kubernetes repository.
|
|
ansible.builtin.apt_repository:
|
|
repo: "{{ kubernetes_apt_repository_pkgs_k8s_io }}"
|
|
filename: pkgs_k8s_io
|
|
state: present
|
|
update_cache: true
|
|
|
|
- name: Add Kubernetes apt preferences file to pin a version.
|
|
template:
|
|
src: apt-preferences-kubernetes.j2
|
|
dest: /etc/apt/preferences.d/kubernetes
|
|
mode: 0644
|