Skip to content

Commit

Permalink
Merge pull request #153 from ndouglas/nd_patch_1
Browse files Browse the repository at this point in the history
Adopt `deb822_repository` format.
  • Loading branch information
geerlingguy authored Dec 13, 2024
2 parents 210a0ab + 32292cf commit 6baa5d7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 26 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ Options passed to `kubeadm init` when initializing the Kubernetes control plane.

```yaml
kubernetes_apt_release_channel: "stable"
kubernetes_apt_keyring_file: "/etc/apt/keyrings/kubernetes-apt-keyring.asc"
kubernetes_apt_repository: "deb [signed-by={{ kubernetes_apt_keyring_file }}] https://pkgs.k8s.io/core:/{{ kubernetes_apt_release_channel }}:/v{{ kubernetes_version }}/deb/ /"
kubernetes_apt_repository: "https://pkgs.k8s.io/core:/{{ kubernetes_apt_release_channel }}:/v{{ kubernetes_version }}/deb/"
```

Apt repository options for Kubernetes installation.
Expand Down
3 changes: 1 addition & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ kubernetes_version_kubeadm: 'stable-{{ kubernetes_version }}'
kubernetes_ignore_preflight_errors: 'all'

kubernetes_apt_release_channel: "stable"
kubernetes_apt_keyring_file: "/etc/apt/keyrings/kubernetes-apt-keyring.asc"
kubernetes_apt_repository: "deb [signed-by={{ kubernetes_apt_keyring_file }}] https://pkgs.k8s.io/core:/{{ kubernetes_apt_release_channel }}:/v{{ kubernetes_version }}/deb/ /"
kubernetes_apt_repository: "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_gpg_key: "https://pkgs.k8s.io/core:/stable:/v{{ kubernetes_version }}/rpm/repodata/repomd.xml.key"
Expand Down
34 changes: 12 additions & 22 deletions tasks/setup-Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,22 @@
name:
- apt-transport-https
- ca-certificates
- python3-debian
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.
ansible.builtin.apt_repository:
repo: "{{ kubernetes_apt_repository }}"
filename: pkgs_k8s_io
state: present
deb822_repository:
name: kubernetes
types: deb
uris: "{{ kubernetes_apt_repository }}"
suites: /
signed_by: "{{ kubernetes_apt_repository }}/Release.key"
register: kubernetes_repository

- name: Update Apt cache.
apt:
update_cache: true
when: kubernetes_repository.changed

- name: Add Kubernetes apt preferences file to pin a version.
template:
Expand Down

0 comments on commit 6baa5d7

Please sign in to comment.