Update 'install_kubetools.yml'

master
alecsandru 9 months ago
parent 8b0ad448ea
commit 6d785c40f8
  1. 10
      install_kubetools.yml

@ -18,16 +18,26 @@
path: /etc/apt/keyrings path: /etc/apt/keyrings
state: directory state: directory
mode: '755' mode: '755'
- name: Check if keyring exists
stat:
path: /etc/apt/keyrings/kubernetes-apt-keyring.gpg Release.key
register: keyring_file
- name: Install certificate - name: Install certificate
command: "{{ item }} chdir=/tmp" command: "{{ item }} chdir=/tmp"
with_items: with_items:
- "curl -o Release.key -fsSL https://pkgs.k8s.io/core:/stable:/{{ K8S_VERSION }}/deb/Release.key" - "curl -o Release.key -fsSL https://pkgs.k8s.io/core:/stable:/{{ K8S_VERSION }}/deb/Release.key"
- "gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg Release.key" - "gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg Release.key"
- "rm Release.key" - "rm Release.key"
when: not keyring_file.stat.exists
- name: Check if apt repo exists
stat:
path: /etc/apt/sources.list.d/kubernetes.list
register: apt_repo
- name: Setup APT repo - name: Setup APT repo
copy: copy:
dest: /etc/apt/sources.list.d/kubernetes.list dest: /etc/apt/sources.list.d/kubernetes.list
content: "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/{{ K8S_VERSION }}/deb/ /" content: "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/{{ K8S_VERSION }}/deb/ /"
when: not apt_repo.stat.exists
- name: Update cache - name: Update cache
apt: apt:
update_cache: yes update_cache: yes

Loading…
Cancel
Save