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/kube-master/tasks/main.yml
This commit is contained in:
@ -1,65 +1,3 @@
|
||||
#- name: Initialize Kubernetes master
|
||||
# command: kubeadm init --pod-network-cidr=192.168.3.0/16 --apiserver-advertise-address=192.168.2.50
|
||||
# creates: /etc/kubernetes/admin.conf
|
||||
|
||||
|
||||
- name: Instalar pip3 no host remoto
|
||||
ansible.builtin.apt:
|
||||
name: python3-pip
|
||||
state: present
|
||||
update_cache: true
|
||||
|
||||
|
||||
- name: Instalar ruamel.yaml no host remoto
|
||||
ansible.builtin.pip:
|
||||
name: ruamel.yaml
|
||||
executable: pip3
|
||||
|
||||
|
||||
- name: Fazer download do manifest oficial do Flannel
|
||||
get_url:
|
||||
url: https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml
|
||||
dest: /tmp/kube-flannel.yml
|
||||
|
||||
- name: Substituir o CIDR da rede no manifest
|
||||
replace:
|
||||
path: /tmp/kube-flannel.yml
|
||||
regexp: '10\.244\.0\.0/16'
|
||||
replace: '192.168.3.0/16'
|
||||
|
||||
|
||||
- name: Corrigir net-conf.json no manifest do Flannel
|
||||
ansible.builtin.script:
|
||||
cmd: patch_netconf.py
|
||||
|
||||
|
||||
- name: cat flannel
|
||||
shell: |
|
||||
cat /tmp/kube-flannel.yml
|
||||
register: flannel_manifest
|
||||
|
||||
- name: Mostrar conteúdo do manifest
|
||||
debug:
|
||||
var: flannel_manifest.stdout
|
||||
|
||||
- name: Forçar uso da interface correta
|
||||
replace:
|
||||
path: /tmp/kube-flannel.yml
|
||||
regexp: 'command:
|
||||
|
||||
\[.*?flanneld.*?\]
|
||||
|
||||
'
|
||||
replace: |
|
||||
command:
|
||||
- /opt/bin/flanneld
|
||||
- --ip-masq
|
||||
- --kube-subnet-mgr
|
||||
- --iface=eth1
|
||||
|
||||
|
||||
|
||||
|
||||
- name: Inicializar o cluster com kubeadm
|
||||
command:
|
||||
argv:
|
||||
@ -105,28 +43,14 @@
|
||||
delay: 6
|
||||
become: yes
|
||||
|
||||
- name: cat flannel
|
||||
shell: |
|
||||
cat /tmp/kube-flannel.yml
|
||||
register: flannel_manifest2
|
||||
|
||||
- name: Mostrar conteúdo do manifest
|
||||
debug:
|
||||
var: flannel_manifest2.stdout
|
||||
|
||||
- name: Aplicar o manifest do Flannel
|
||||
- name: Install Calico CNI
|
||||
become: yes
|
||||
become_user: fenix
|
||||
shell: |
|
||||
kubectl apply -f /tmp/kube-flannel.yml
|
||||
kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
|
||||
environment:
|
||||
KUBECONFIG: /etc/kubernetes/admin.conf
|
||||
|
||||
#- name: Install Calico CNI
|
||||
# become: yes
|
||||
# become_user: fenix
|
||||
# shell: |
|
||||
# kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
|
||||
# environment:
|
||||
# KUBECONFIG: /home/fenix/.kube/config
|
||||
KUBECONFIG: /home/fenix/.kube/config
|
||||
|
||||
- name: Get kubeadm join command
|
||||
shell: kubeadm token create --print-join-command
|
||||
|
||||
Reference in New Issue
Block a user