diff options
Diffstat (limited to 'bin/prepare_minion.py')
-rwxr-xr-x | bin/prepare_minion.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/bin/prepare_minion.py b/bin/prepare_minion.py new file mode 100755 index 0000000..e89434a --- /dev/null +++ b/bin/prepare_minion.py @@ -0,0 +1,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') |