mirror of
https://gitea.fenix-dev.com/fenix-gitea-admin/iac-ansible-private.git
synced 2025-10-27 16:53:04 +00:00
Update roles/kube-master/tasks/main.yml
This commit is contained in:
@ -2,6 +2,56 @@
|
|||||||
# command: kubeadm init --pod-network-cidr=192.168.3.0/16 --apiserver-advertise-address=192.168.2.50
|
# command: kubeadm init --pod-network-cidr=192.168.3.0/16 --apiserver-advertise-address=192.168.2.50
|
||||||
# creates: /etc/kubernetes/admin.conf
|
# creates: /etc/kubernetes/admin.conf
|
||||||
|
|
||||||
|
- 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
|
- name: Inicializar o cluster com kubeadm
|
||||||
command:
|
command:
|
||||||
argv:
|
argv:
|
||||||
@ -47,47 +97,6 @@
|
|||||||
delay: 6
|
delay: 6
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
- 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: cat flannel
|
- name: cat flannel
|
||||||
shell: |
|
shell: |
|
||||||
cat /tmp/kube-flannel.yml
|
cat /tmp/kube-flannel.yml
|
||||||
|
|||||||
Reference in New Issue
Block a user