summaryrefslogtreecommitdiffstats
path: root/bin/prepare_minion.py
diff options
context:
space:
mode:
authorGeorg Pfuetzenreuter2023-01-15 09:18:15 +0100
committerGeorg Pfuetzenreuter2023-01-15 09:18:15 +0100
commitf1a4b0514c148d9b5477f5c2b11938445e4438b1 (patch)
tree003745428e583f6d3287f0259040dc1358503505 /bin/prepare_minion.py
downloadsalt-f1a4b0514c148d9b5477f5c2b11938445e4438b1.tar.gz
salt-f1a4b0514c148d9b5477f5c2b11938445e4438b1.tar.bz2
salt-f1a4b0514c148d9b5477f5c2b11938445e4438b1.zip
Init
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
Diffstat (limited to 'bin/prepare_minion.py')
-rwxr-xr-xbin/prepare_minion.py22
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')