Update roles/kubernetes/tasks/main.yml

This commit is contained in:
2025-10-20 12:51:32 +00:00
parent 16a6fae38e
commit 5401347945

View File

@ -1,47 +1,64 @@
- name: Install containerd - name: disable UFW firewall for labs
apt: service:
name: containerd name: ufw
state: stopped
enabled: false
- name: Disable SWAP
shell: |
swapoff -a
- name: Disable SWAP in fstab
lineinfile:
path: /etc/fstab
regexp: '^.*swap.*$'
line: '#\0'
backrefs: yes
- name: ensure net.bridge.bridge-nf-call-ip6tables is set to 1
sysctl:
name: net.bridge.bridge-nf-call-iptables
value: '1'
state: present state: present
update_cache: no reload: yes
become: true
- name: Hold Kubernetes packages - name: Installation of apt-utils
become: true apt:
ansible.builtin.shell: | name: apt-transport-https
apt-mark hold containerd state: present
update_cache: yes
- name: Adding Docker GPG key
ansible.builtin.apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Adding Docker Repository
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable
state: present
- name: Criar diretório .kube para o usuário ubuntu - name: Installation of Docker
become: true apt:
ansible.builtin.file: name: "{{ item }}"
path: /run/flannel state: present
state: directory loop:
owner: root - docker-ce
group: root - docker-ce-cli
mode: 0755 - containerd.io
- docker-compose
- name: Criar ou sobrescrever /run/flannel/subnet.env - name: Setting value of SystemdCgroup
become: true shell: |
copy: containerd config default | sudo tee /etc/containerd/config.toml | grep SystemdCgroup
dest: /run/flannel/subnet.env sed -i 's/SystemdCgroup = false/SystemdCgroup = true/g' /etc/containerd/config.toml
content: |
FLANNEL_NETWORK=192.168.2.0/16 - name : Starting Service of Docker
FLANNEL_SUBNET=192.168.2.1/24 service:
FLANNEL_MTU=1450 name: docker
FLANNEL_IPMASQ=true state: started
owner: root enabled: yes
group: root
mode: '0644'
#- 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 - name: Adicionar chave GPG do Kubernetes
become: true become: true