salt/bin/prepare_minion.py
Georg Pfuetzenreuter f1a4b0514c
Init
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2023-01-15 09:18:15 +01:00

23 lines
458 B
Python
Executable File

#!/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')