summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/prepare_minion.py22
-rwxr-xr-xbin/prepare_mock.py13
-rwxr-xr-xbin/roles.py13
3 files changed, 48 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')
diff --git a/bin/prepare_mock.py b/bin/prepare_mock.py
new file mode 100755
index 0000000..982ca32
--- /dev/null
+++ b/bin/prepare_mock.py
@@ -0,0 +1,13 @@
+#!/usr/bin/env python3
+
+import os
+import shutil
+import socket
+
+iddir = 'pillar/id/'
+secretiddir = 'pillar/secret/id/'
+baseidfile = 'atvkdev02_home_lysergic_dev.sls'
+myidfile = socket.gethostname() + '.sls'
+
+shutil.copyfile(iddir + baseidfile, iddir + myidfile)
+shutil.copyfile(secretiddir + baseidfile, secretiddir + myidfile)
diff --git a/bin/roles.py b/bin/roles.py
new file mode 100755
index 0000000..1777f8c
--- /dev/null
+++ b/bin/roles.py
@@ -0,0 +1,13 @@
+#!/usr/bin/env python3
+
+import os
+
+roles = []
+excluded = ['common-suse', 'minion']
+
+def get():
+ for file in os.listdir('salt/role'):
+ role = os.path.splitext(file)[0]
+ if not role in excluded:
+ roles.append(role)
+ return roles