mirror of
https://gitea.fenix-dev.com/fenix-gitea-admin/iac-ansible-private.git
synced 2025-10-28 00:57:57 +00:00
Add roles/kube-master/tasks/patch_netconf.py
This commit is contained in:
21
roles/kube-master/tasks/patch_netconf.py
Normal file
21
roles/kube-master/tasks/patch_netconf.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
from ruamel.yaml import YAML
|
||||||
|
|
||||||
|
yaml = YAML()
|
||||||
|
yaml.preserve_quotes = True
|
||||||
|
|
||||||
|
with open("/tmp/kube-flannel.yml", "r") as f:
|
||||||
|
docs = list(yaml.load_all(f))
|
||||||
|
|
||||||
|
for doc in docs:
|
||||||
|
if doc.get("kind") == "ConfigMap" and doc.get("metadata", {}).get("name") == "kube-flannel-cfg":
|
||||||
|
doc["data"]["net-conf.json"] = '''{
|
||||||
|
"Network": "192.168.3.0/16",
|
||||||
|
"Backend": {
|
||||||
|
"Type": "vxlan"
|
||||||
|
},
|
||||||
|
"Interface": "eth1"
|
||||||
|
}'''
|
||||||
|
|
||||||
|
with open("/tmp/kube-flannel.yml", "w") as f:
|
||||||
|
yaml.dump_all(docs, f)
|
||||||
Reference in New Issue
Block a user