mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-05-20 15:27:56 -02:30
Add reading group variables
This commit is contained in:
@@ -5,16 +5,23 @@
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
|
import yaml
|
||||||
|
|
||||||
def read_nodes_from_file(filename):
|
def read_nodes_from_file(filename):
|
||||||
f = open(filename, 'r')
|
f = open(filename, 'r')
|
||||||
content = [x.strip('\n') for x in f.readlines()]
|
content = [x.strip('\n') for x in f.readlines()]
|
||||||
return content
|
return content
|
||||||
|
|
||||||
|
def read_vars_from_file(src="/root/kargo/inventory/group_vars/all.yml"):
|
||||||
|
with open(src, 'r') as f:
|
||||||
|
content = yaml.load(f)
|
||||||
|
return content
|
||||||
|
|
||||||
def nodes_to_hash(nodes_list, masters):
|
def nodes_to_hash(nodes_list, masters):
|
||||||
nodes = {
|
nodes = {
|
||||||
'all': {
|
'all': {
|
||||||
'hosts': [],
|
'hosts': [],
|
||||||
|
'vars': read_vars_from_file()
|
||||||
},
|
},
|
||||||
'etcd': {
|
'etcd': {
|
||||||
'hosts': [],
|
'hosts': [],
|
||||||
|
|||||||
Reference in New Issue
Block a user