mirror of
https://gitea.fenix-dev.com/fenix-gitea-admin/iac-ansible-private.git
synced 2025-10-27 08:43:05 +00:00
Update roles/kubernetes/tasks/main.yml
This commit is contained in:
@ -1,3 +1,16 @@
|
|||||||
|
- name: 1 Wait for Kubernetes API to be ready
|
||||||
|
shell: |
|
||||||
|
kubectl get --raw='/healthz'
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
|
register: api_health
|
||||||
|
until: api_health.rc == 0
|
||||||
|
retries: 10
|
||||||
|
delay: 6
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- name: Install containerd
|
- name: Install containerd
|
||||||
apt:
|
apt:
|
||||||
name: containerd
|
name: containerd
|
||||||
@ -26,6 +39,16 @@
|
|||||||
content: |
|
content: |
|
||||||
deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.29/deb/ /
|
deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.29/deb/ /
|
||||||
|
|
||||||
|
- name: 2.2 Wait for Kubernetes API to be ready
|
||||||
|
shell: |
|
||||||
|
kubectl get --raw='/healthz'
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
|
register: api_health
|
||||||
|
until: api_health.rc == 0
|
||||||
|
retries: 10
|
||||||
|
delay: 6
|
||||||
|
become: yes
|
||||||
|
|
||||||
- name: Install Kubernetes components
|
- name: Install Kubernetes components
|
||||||
apt:
|
apt:
|
||||||
@ -40,6 +63,17 @@
|
|||||||
ansible.builtin.shell: |
|
ansible.builtin.shell: |
|
||||||
apt-mark hold kubelet kubeadm kubectl
|
apt-mark hold kubelet kubeadm kubectl
|
||||||
|
|
||||||
|
- name: 2.3 Wait for Kubernetes API to be ready
|
||||||
|
shell: |
|
||||||
|
kubectl get --raw='/healthz'
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
|
register: api_health
|
||||||
|
until: api_health.rc == 0
|
||||||
|
retries: 10
|
||||||
|
delay: 6
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
|
||||||
- name: Ativar ip_forward de forma idempotente
|
- name: Ativar ip_forward de forma idempotente
|
||||||
ansible.builtin.sysctl:
|
ansible.builtin.sysctl:
|
||||||
@ -52,6 +86,18 @@
|
|||||||
ansible.builtin.command: sysctl --system
|
ansible.builtin.command: sysctl --system
|
||||||
when: ansible_facts['os_family'] == 'Debian'
|
when: ansible_facts['os_family'] == 'Debian'
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
|
- name: 2.4 Wait for Kubernetes API to be ready
|
||||||
|
shell: |
|
||||||
|
kubectl get --raw='/healthz'
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
|
register: api_health
|
||||||
|
until: api_health.rc == 0
|
||||||
|
retries: 10
|
||||||
|
delay: 6
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
|
||||||
- name: Criar arquivo de configuração sysctl para Kubernetes
|
- name: Criar arquivo de configuração sysctl para Kubernetes
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
@ -69,6 +115,19 @@
|
|||||||
name: br_netfilter
|
name: br_netfilter
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
|
- name: 2.5 Wait for Kubernetes API to be ready
|
||||||
|
shell: |
|
||||||
|
kubectl get --raw='/healthz'
|
||||||
|
environment:
|
||||||
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
|
register: api_health
|
||||||
|
until: api_health.rc == 0
|
||||||
|
retries: 10
|
||||||
|
delay: 6
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- name: Garantir que o módulo br_netfilter seja carregado na inicialização
|
- name: Garantir que o módulo br_netfilter seja carregado na inicialização
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
dest: /etc/modules-load.d/k8s.conf
|
dest: /etc/modules-load.d/k8s.conf
|
||||||
|
|||||||
Reference in New Issue
Block a user