summaryrefslogtreecommitdiffstats
path: root/bin/prepare_minion.py
blob: e89434a18795f82d2d27c3a13f7e5e2207804e97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env python3

import roles
import os
import yaml
import socket

roles = roles.get()
grainsfile = '/etc/salt/grains'
idfile = 'pillar/id/' + socket.gethostname() + '.sls'
mypwd = os.getcwd()

grainsdata = {'roles': roles}

with open(grainsfile, mode='w') as grainsfh:
	yaml.dump(grainsdata, grainsfh)

with open(idfile, mode='w') as idfh:
	idfh.write('# empty')

os.symlink(mypwd + '/salt', '/srv/salt')
os.symlink(mypwd + '/pillar', '/srv/pillar')