From f1a4b0514c148d9b5477f5c2b11938445e4438b1 Mon Sep 17 00:00:00 2001 From: Georg Pfuetzenreuter Date: Sun, 15 Jan 2023 09:18:15 +0100 Subject: Init Signed-off-by: Georg Pfuetzenreuter --- bin/prepare_minion.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 bin/prepare_minion.py (limited to 'bin/prepare_minion.py') 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') -- cgit v1.2.3