Add reading group variables
This commit is contained in:
parent
c4e3266031
commit
737a83788f
1 changed files with 7 additions and 0 deletions
|
@ -5,16 +5,23 @@
|
|||
|
||||
import argparse
|
||||
import json
|
||||
import yaml
|
||||
|
||||
def read_nodes_from_file(filename):
|
||||
f = open(filename, 'r')
|
||||
content = [x.strip('\n') for x in f.readlines()]
|
||||
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):
|
||||
nodes = {
|
||||
'all': {
|
||||
'hosts': [],
|
||||
'vars': read_vars_from_file()
|
||||
},
|
||||
'etcd': {
|
||||
'hosts': [],
|
||||
|
|
Loading…
Reference in a new issue