Compare commits
6 Commits
c53abe2b6a
...
empty-pill
Author | SHA1 | Date | |
---|---|---|---|
cc0e8f7aff
|
|||
8024449e2b
|
|||
37e659cfc3
|
|||
05d7cef80c
|
|||
6d843a0b65
|
|||
2b9420afa9
|
3
pillar/top.sls
Normal file
3
pillar/top.sls
Normal file
@ -0,0 +1,3 @@
|
||||
{{ saltenv }}:
|
||||
'*':
|
||||
[]
|
1
stack/stack.cfg
Normal file
1
stack/stack.cfg
Normal file
@ -0,0 +1 @@
|
||||
[]
|
40
states/salt/minion/init.sls
Normal file
40
states/salt/minion/init.sls
Normal file
@ -0,0 +1,40 @@
|
||||
{%- set masters = ['salt.nerdhouse.io'] %}
|
||||
|
||||
salt-minion:
|
||||
pkg.installed:
|
||||
- version: latest
|
||||
service.running:
|
||||
- enable: true
|
||||
- require:
|
||||
- pkg: salt-minion
|
||||
- file: /etc/salt/minion
|
||||
|
||||
restart-salt-minion:
|
||||
cmd.run:
|
||||
- name: sleep 10 && systemctl restart salt-minion
|
||||
- bg: true
|
||||
- order: last
|
||||
- onchanges:
|
||||
- pkg: salt-minion
|
||||
- file: /etc/salt/minion
|
||||
- require:
|
||||
- cmd: check-minion-config
|
||||
|
||||
/etc/salt/minion:
|
||||
file.managed:
|
||||
- source: salt://{{ slspath }}/templates/minion.jinja
|
||||
- template: jinja
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 644
|
||||
- context:
|
||||
masters: {{ masters|json }}
|
||||
- require:
|
||||
- pkg: salt-minion
|
||||
|
||||
check-minion-config:
|
||||
cmd.run:
|
||||
- name: sudo salt-call --local --skip-grains test.true
|
||||
- onchanges:
|
||||
- pkg: salt-minion
|
||||
- file: /etc/salt/minion
|
26
states/salt/minion/templates/minion.jinja
Normal file
26
states/salt/minion/templates/minion.jinja
Normal file
@ -0,0 +1,26 @@
|
||||
id: {{ grains.id|lower }}
|
||||
log_level: info
|
||||
ipv6: true
|
||||
ssl: true
|
||||
transport: tcp
|
||||
|
||||
# https://github.com/saltstack/salt/blob/b95213ec903402f25c1e0aeb3990fe8452ab63ce/conf/minion#L39-L47
|
||||
# str, failover or disable
|
||||
master_type: str
|
||||
{% if masters is defined %}
|
||||
master:
|
||||
{%- for master in masters %}
|
||||
- {{ master }}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
|
||||
# set the default saltenv for highstate
|
||||
# otherwise it tries to run all of them 🤔
|
||||
saltenv: base
|
||||
# useful for influencing git_pillar and gitfs at the same time
|
||||
pillarenv_from_saltenv: true
|
||||
|
||||
enable_fqdns_grains: false
|
||||
enable_gpu_grains: false
|
||||
|
||||
# vim: ft=yaml
|
@ -2,3 +2,4 @@
|
||||
'*':
|
||||
- users
|
||||
- sshd
|
||||
- salt.minion
|
||||
|
@ -16,4 +16,9 @@
|
||||
{%- if user.shell is defined %}
|
||||
- shell: {{ user.shell }}
|
||||
{%- endif %}
|
||||
ssh_auth.manage:
|
||||
- user: {{ name }}
|
||||
{%- if user['ssh-keys'] is defined %}
|
||||
- ssh_keys: {{ user['ssh-keys']|json }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
|
@ -4,6 +4,9 @@
|
||||
{%- do admin_groups.append('systemd-journal') %}
|
||||
{%- endif %}
|
||||
|
||||
{# FIXME(frebib): manage Docker group instead of blindly adding it #}
|
||||
{%- do admin_groups.append('docker') %}
|
||||
|
||||
frebib:
|
||||
groups:
|
||||
{%- for group in admin_groups %}
|
||||
@ -12,6 +15,7 @@ frebib:
|
||||
ssh-keys:
|
||||
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINk+sOUEXKsGqITyMhna9v77ADGagkr3YMpgZFkrvqcd frebib@frebib-PC
|
||||
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBIGxhZPQM/3Ck+DNNM0CoIZTsvKqQLKq8fqQoO6fXzX frebib@frebib-OnePlus3
|
||||
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL+T8ChEU9YmpE2BY77oEtKzedB8HWDSM5bErDN9gcvj frebib@frebib-Cf
|
||||
|
||||
adam:
|
||||
groups:
|
||||
|
Reference in New Issue
Block a user