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
9 changed files with 19 additions and 14 deletions

View File

@ -5,12 +5,14 @@ import roles
import os
import yaml
import socket
import yaml
roles = roles.get()
grainsfile = '/etc/salt/grains'
idfile = 'pillar/id/' + socket.gethostname() + '.sls'
idfile = os.path.join('pillar/id/', socket.gethostname() + '.sls')
configfile = '/etc/salt/minion.d/local.conf'
mypwd = os.getcwd()
formulasfile = 'formulas.yaml'
grainsdata = {'roles': roles}
@ -20,16 +22,17 @@ with open(grainsfile, mode='w') as grainsfh:
with open(idfile, mode='w') as idfh:
idfh.write('# empty')
# to-do: include formulas automatically, maybe from some YAML file?
with open(configfile, mode='w') as configfh:
configfh.write('''# written by prepare_minion.py
with open(formulasfile, mode='r') as formulasfh:
formulas = yaml.load(formulasfh, Loader=yaml.FullLoader)
with open(configfile, mode='w') as configfh:
configfh.write('''# written by prepare_minion.py
file_roots:
production:
- /srv/salt
- /srv/formulas/salt-formula
- /srv/formulas/users-formula
- /srv/formulas/postfix-formula
''')
for formula in formulas:
configfh.write(formula)
os.symlink(mypwd + '/salt', '/srv/salt')
os.symlink(mypwd + '/pillar', '/srv/pillar')

1
formulas.yaml Symbolic link
View File

@ -0,0 +1 @@
pillar/formulas.yaml

3
pillar/formulas.yaml Normal file
View File

@ -0,0 +1,3 @@
- postfix
- salt
- users

View File

@ -1,7 +1,7 @@
include:
- role.salt.common
- role.salt.minion
- role.mta.postfix
- .mta
managed_header_pound: |
### This file is managed via https://git.com.de/LibertaCasa/salt

View File

@ -1,4 +1,4 @@
{%- set formulas = ['salt', 'users', 'postfix'] -%}
{%- import_yaml 'formulas.yaml' as formulas -%}
include:
- role.salt.common

View File

@ -3,7 +3,7 @@
{{ saltenv }}:
'*':
- common
- global
'id:{{ id }}':
- match: grain
- ignore_missing: True

View File

@ -3,7 +3,8 @@ include:
- profile.zypp
- profile.node_exporter
- users
- role.mta.postfix
- postfix
- postfix.config
{#- to-do: move this to some formula or macro -#}
{%- set osfullname = grains['osfullname'] -%}

View File

@ -1,3 +0,0 @@
include:
- postfix
- postfix.config