Compare commits
3 Commits
9aa39f97e4
...
b435117808
Author | SHA1 | Date | |
---|---|---|---|
b435117808 | |||
e93fd5c0a8 | |||
18e26723dd |
@ -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
1
formulas.yaml
Symbolic link
@ -0,0 +1 @@
|
||||
pillar/formulas.yaml
|
3
pillar/formulas.yaml
Normal file
3
pillar/formulas.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
- postfix
|
||||
- salt
|
||||
- users
|
@ -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
|
@ -1,4 +1,4 @@
|
||||
{%- set formulas = ['salt', 'users', 'postfix'] -%}
|
||||
{%- import_yaml 'formulas.yaml' as formulas -%}
|
||||
|
||||
include:
|
||||
- role.salt.common
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
{{ saltenv }}:
|
||||
'*':
|
||||
- common
|
||||
- global
|
||||
'id:{{ id }}':
|
||||
- match: grain
|
||||
- ignore_missing: True
|
||||
|
@ -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'] -%}
|
||||
|
@ -1,3 +0,0 @@
|
||||
include:
|
||||
- postfix
|
||||
- postfix.config
|
Loading…
x
Reference in New Issue
Block a user