mirror of
https://gitea.fenix-dev.com/fenix-gitea-admin/iac-ansible-private.git
synced 2025-10-27 08:43:05 +00:00
Compare commits
10 Commits
47b3cb9bd4
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 5d60378c35 | |||
| 892b80c438 | |||
| 39dd5e0c72 | |||
| 9385da0ed1 | |||
| feefc19d09 | |||
| 3c990702ed | |||
| 55ac95fc90 | |||
| 880c7b23f1 | |||
| 78e1bb9b48 | |||
| 2391d89175 |
@ -1,9 +1,9 @@
|
|||||||
[kube-master]
|
[kube-master]
|
||||||
master1 ansible_host=192.168.1.10 ansible_user=ubuntu
|
master1 ansible_host=192.168.1.10 ansible_user=ubuntu ansible_ssh_common_args='-o StrictHostKeyChecking=no'
|
||||||
|
|
||||||
[kube-node]
|
[kube-node]
|
||||||
node1 ansible_host=192.168.1.11 ansible_user=ubuntu
|
node1 ansible_host=192.168.1.11 ansible_user=ubuntu ansible_ssh_common_args='-o StrictHostKeyChecking=no'
|
||||||
node2 ansible_host=192.168.1.12 ansible_user=ubuntu
|
node2 ansible_host=192.168.1.12 ansible_user=ubuntu ansible_ssh_common_args='-o StrictHostKeyChecking=no'
|
||||||
|
|
||||||
[all:vars]
|
#[all:vars]
|
||||||
ansible_python_interpreter=/usr/bin/python3
|
#ansible_python_interpreter=/usr/bin/python3
|
||||||
@ -3,6 +3,7 @@
|
|||||||
become: yes
|
become: yes
|
||||||
roles:
|
roles:
|
||||||
- common
|
- common
|
||||||
|
- vaultwarden
|
||||||
- kubernetes
|
- kubernetes
|
||||||
- kube-master
|
- kube-master
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
replace:
|
replace:
|
||||||
path: /tmp/kube-flannel.yml
|
path: /tmp/kube-flannel.yml
|
||||||
regexp: '10\.244\.0\.0/16'
|
regexp: '10\.244\.0\.0/16'
|
||||||
replace: '192.168.2.0/24' # .3.
|
replace: '10.244.0.0/16' # .3.
|
||||||
|
|
||||||
- name: Corrigir net-conf.json no manifest do Flannel
|
- name: Corrigir net-conf.json no manifest do Flannel
|
||||||
become: true
|
become: true
|
||||||
@ -40,12 +40,12 @@
|
|||||||
debug:
|
debug:
|
||||||
var: flannel_manifest.stdout
|
var: flannel_manifest.stdout
|
||||||
|
|
||||||
- name: Adicionar --iface=eth1 ao flanneld
|
- name: Adicionar --iface=eth0 ao flanneld
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: /tmp/kube-flannel.yml
|
path: /tmp/kube-flannel.yml
|
||||||
insertafter: ' - --kube-subnet-mgr'
|
insertafter: ' - --kube-subnet-mgr'
|
||||||
line: ' - --iface=eth1'
|
line: ' - --iface=eth0'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -55,7 +55,7 @@
|
|||||||
argv:
|
argv:
|
||||||
- kubeadm
|
- kubeadm
|
||||||
- init
|
- init
|
||||||
- --pod-network-cidr=192.168.2.0/24 # .3.
|
- --pod-network-cidr=10.244.0.0/16 # .3.
|
||||||
- --apiserver-advertise-address=192.168.1.150
|
- --apiserver-advertise-address=192.168.1.150
|
||||||
creates: /etc/kubernetes/admin.conf
|
creates: /etc/kubernetes/admin.conf
|
||||||
|
|
||||||
|
|||||||
@ -10,11 +10,11 @@ with open("/tmp/kube-flannel.yml", "r") as f:
|
|||||||
for doc in docs:
|
for doc in docs:
|
||||||
if doc.get("kind") == "ConfigMap" and doc.get("metadata", {}).get("name") == "kube-flannel-cfg":
|
if doc.get("kind") == "ConfigMap" and doc.get("metadata", {}).get("name") == "kube-flannel-cfg":
|
||||||
doc["data"]["net-conf.json"] = '''{
|
doc["data"]["net-conf.json"] = '''{
|
||||||
"Network": "192.168.2.0/24",
|
"Network": "10.244.0.0/16",
|
||||||
"Backend": {
|
"Backend": {
|
||||||
"Type": "vxlan"
|
"Type": "vxlan"
|
||||||
},
|
},
|
||||||
"Interface": "eth1"
|
"Interface": "eth0"
|
||||||
}'''
|
}'''
|
||||||
|
|
||||||
with open("/tmp/kube-flannel.yml", "w") as f:
|
with open("/tmp/kube-flannel.yml", "w") as f:
|
||||||
|
|||||||
@ -23,9 +23,9 @@
|
|||||||
- node_status.stdout | trim == "NOT_IN_CLUSTER"
|
- node_status.stdout | trim == "NOT_IN_CLUSTER"
|
||||||
|
|
||||||
|
|
||||||
- name: Atribuir podCIDR ao nó via hostname real
|
#- name: Atribuir podCIDR ao nó via hostname real
|
||||||
shell: |
|
# shell: |
|
||||||
kubectl patch node {{ node_hostname.stdout }} -p '{"spec":{"podCIDR":"192.168.2.0/24"}}'
|
# kubectl patch node {{ node_hostname.stdout }} -p '{"spec":{"podCIDR":"192.168.2.0/24"}}'
|
||||||
when:
|
# when:
|
||||||
- hostvars['master1']['kubeadm_join_command'] is defined
|
# - hostvars['master1']['kubeadm_join_command'] is defined
|
||||||
- node_status.stdout | trim == "NOT_IN_CLUSTER"
|
# - node_status.stdout | trim == "NOT_IN_CLUSTER"
|
||||||
0
roles/stolon/tasks/main.yml
Normal file
0
roles/stolon/tasks/main.yml
Normal file
4
roles/vaultwarden/tasks/main.yml
Normal file
4
roles/vaultwarden/tasks/main.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
- name: Buscar secret do Vaultwarden
|
||||||
|
command: "bw get item 'nome-do-secret'"
|
||||||
|
register: secret_raw
|
||||||
|
#no_log: true
|
||||||
Reference in New Issue
Block a user