Skip to content

Commit

Permalink
Merge pull request #150 from rdxmb/master
Browse files Browse the repository at this point in the history
update apt sources, add apt keyring gpg
  • Loading branch information
geerlingguy authored Mar 5, 2024
2 parents 2f9f167 + 8a50ed5 commit 928c143
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
7 changes: 3 additions & 4 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,9 @@ kubernetes_apiserver_advertise_address: ''
kubernetes_version_kubeadm: 'stable-{{ kubernetes_version }}'
kubernetes_ignore_preflight_errors: 'all'

kubernetes_apt_release_channel: main
# Note that xenial repo is used for all Debian derivatives at this time.
kubernetes_apt_repository: "deb http://apt.kubernetes.io/ kubernetes-xenial {{ kubernetes_apt_release_channel }}"
kubernetes_apt_ignore_key_error: false
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/ /"

Check warning on line 56 in defaults/main.yml

View workflow job for this annotation

GitHub Actions / Lint

56:151 [line-length] line too long (175 > 150 characters)

Check warning on line 56 in defaults/main.yml

View workflow job for this annotation

GitHub Actions / Lint

56:151 [line-length] line too long (175 > 150 characters)

kubernetes_yum_arch: '$basearch'
kubernetes_yum_base_url: "https://packages.cloud.google.com/yum/repos/kubernetes-el7-{{ kubernetes_yum_arch }}"
Expand Down
26 changes: 19 additions & 7 deletions tasks/setup-Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,28 @@
- ca-certificates
state: present

- name: Add Kubernetes apt key.
apt_key:
url: https://packages.cloud.google.com/apt/doc/apt-key.gpg
state: present
register: add_repository_key
ignore_errors: "{{ kubernetes_apt_ignore_key_error }}"
- 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.
apt_repository:
ansible.builtin.apt_repository:
repo: "{{ kubernetes_apt_repository }}"
filename: pkgs_k8s_io
state: present
update_cache: true

Expand Down

0 comments on commit 928c143

Please sign in to comment.