Files
iac-ansible-public/roles/kubernetes/tasks/main.yml

46 lines
1.1 KiB
YAML

- name: Install containerd
apt:
name: containerd
state: present
#- name: Add Kubernetes APT key
# apt_key:
# url: https://packages.cloud.google.com/apt/doc/apt-key.gpg
# state: present
#- name: Add Kubernetes repo
# apt_repository:
# repo: deb http://apt.kubernetes.io/ kubernetes-jammy main
# state: present
- name: Adicionar chave GPG do Kubernetes
ansible.builtin.shell: |
mkdir -p /etc/apt/keyrings
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
args:
creates: /etc/apt/keyrings/kubernetes-apt-keyring.gpg
- name: Adicionar repositório oficial do Kubernetes
ansible.builtin.copy:
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:/v1.29/deb/ /
- name: Install Kubernetes components
apt:
name:
- kubelet
- kubeadm
- kubectl
state: present
update_cache: yes
- name: Hold Kubernetes packages
apt:
name:
- kubelet
- kubeadm
- kubectl
state: hold