Compare commits

..

3 Commits

Author SHA1 Message Date
b435117808
mta.postfix->global.mta pillar; remove mta profile
Some checks failed
ci/lysergic/push/pipeline Pipeline failed
This is more a MTA configuration for system email on all hosts instead of
a dedicated email server role.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2023-01-26 20:27:30 +01:00
e93fd5c0a8
Move common to global pillar
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2023-01-26 20:27:29 +01:00
18e26723dd
Read formulas from central file
- add formulas.yaml file containing list of all enabled formulas
- read formulas from said file in role.salt.master and prepare_minion.py
- add symlink for easier tracking of the file

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2023-01-26 20:27:29 +01:00

View File

@ -13,9 +13,7 @@ idfile = os.path.join('pillar/id/', socket.gethostname() + '.sls')
configfile = '/etc/salt/minion.d/local.conf' configfile = '/etc/salt/minion.d/local.conf'
mypwd = os.getcwd() mypwd = os.getcwd()
formulasfile = 'formulas.yaml' formulasfile = 'formulas.yaml'
formulasdir = '/srv/formulas'
configdata = {'file_roots': {'production': ['/srv/salt']}}
grainsdata = {'roles': roles} grainsdata = {'roles': roles}
with open(grainsfile, mode='w') as grainsfh: with open(grainsfile, mode='w') as grainsfh:
@ -27,13 +25,14 @@ with open(idfile, mode='w') as idfh:
with open(formulasfile, mode='r') as formulasfh: with open(formulasfile, mode='r') as formulasfh:
formulas = yaml.load(formulasfh, Loader=yaml.FullLoader) formulas = yaml.load(formulasfh, Loader=yaml.FullLoader)
for formula in formulas: with open(configfile, mode='w') as configfh:
formula = os.path.join('/srv/formulas/', formula + '-formula') configfh.write('''# written by prepare_minion.py
configdata['file_roots']['production'].append(formula) file_roots:
production:
with open(configfile, mode='w') as configfh: - /srv/salt
configfh.write('# written by prepare_minion.py\n') ''')
yaml.dump(configdata, configfh) for formula in formulas:
configfh.write(formula)
os.symlink(mypwd + '/salt', '/srv/salt') os.symlink(mypwd + '/salt', '/srv/salt')
os.symlink(mypwd + '/pillar', '/srv/pillar') os.symlink(mypwd + '/pillar', '/srv/pillar')