Merge pull request #153 from ndouglas/nd_patch_1

Adopt `deb822_repository` format.
This commit is contained in:
Jeff Geerling 2024-12-13 12:26:45 -06:00 committed by GitHub
commit 6baa5d7838
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 26 deletions

View File

@ -141,8 +141,7 @@ Options passed to `kubeadm init` when initializing the Kubernetes control plane.
```yaml ```yaml
kubernetes_apt_release_channel: "stable" kubernetes_apt_release_channel: "stable"
kubernetes_apt_keyring_file: "/etc/apt/keyrings/kubernetes-apt-keyring.asc" kubernetes_apt_repository: "https://pkgs.k8s.io/core:/{{ kubernetes_apt_release_channel }}:/v{{ kubernetes_version }}/deb/"
kubernetes_apt_repository: "deb [signed-by={{ kubernetes_apt_keyring_file }}] https://pkgs.k8s.io/core:/{{ kubernetes_apt_release_channel }}:/v{{ kubernetes_version }}/deb/ /"
``` ```
Apt repository options for Kubernetes installation. Apt repository options for Kubernetes installation.

View File

@ -52,8 +52,7 @@ kubernetes_version_kubeadm: 'stable-{{ kubernetes_version }}'
kubernetes_ignore_preflight_errors: 'all' kubernetes_ignore_preflight_errors: 'all'
kubernetes_apt_release_channel: "stable" kubernetes_apt_release_channel: "stable"
kubernetes_apt_keyring_file: "/etc/apt/keyrings/kubernetes-apt-keyring.asc" kubernetes_apt_repository: "https://pkgs.k8s.io/core:/{{ kubernetes_apt_release_channel }}:/v{{ kubernetes_version }}/deb/"
kubernetes_apt_repository: "deb [signed-by={{ kubernetes_apt_keyring_file }}] https://pkgs.k8s.io/core:/{{ kubernetes_apt_release_channel }}:/v{{ kubernetes_version }}/deb/ /"
kubernetes_yum_base_url: "https://pkgs.k8s.io/core:/stable:/v{{ kubernetes_version }}/rpm/" kubernetes_yum_base_url: "https://pkgs.k8s.io/core:/stable:/v{{ kubernetes_version }}/rpm/"
kubernetes_yum_gpg_key: "https://pkgs.k8s.io/core:/stable:/v{{ kubernetes_version }}/rpm/repodata/repomd.xml.key" kubernetes_yum_gpg_key: "https://pkgs.k8s.io/core:/stable:/v{{ kubernetes_version }}/rpm/repodata/repomd.xml.key"

View File

@ -4,32 +4,22 @@
name: name:
- apt-transport-https - apt-transport-https
- ca-certificates - ca-certificates
- python3-debian
state: present 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.
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
- 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. - name: Add Kubernetes repository.
ansible.builtin.apt_repository: deb822_repository:
repo: "{{ kubernetes_apt_repository }}" name: kubernetes
filename: pkgs_k8s_io types: deb
state: present uris: "{{ kubernetes_apt_repository }}"
suites: /
signed_by: "{{ kubernetes_apt_repository }}/Release.key"
register: kubernetes_repository
- name: Update Apt cache.
apt:
update_cache: true update_cache: true
when: kubernetes_repository.changed
- name: Add Kubernetes apt preferences file to pin a version. - name: Add Kubernetes apt preferences file to pin a version.
template: template: