Compare commits

..

5 Commits

Author SHA1 Message Date
8024449e2b salt/minion: only restart salt-minion on config/pkg change
Signed-off-by: Joe Groocock <me@frebib.net>
2020-07-19 15:21:09 +01:00
37e659cfc3 users: add Docker group to admin users
Signed-off-by: Joe Groocock <me@frebib.net>
2020-07-19 15:13:34 +01:00
05d7cef80c users: manage ssh authorised keys
Signed-off-by: Joe Groocock <me@frebib.net>
2020-07-19 15:10:01 +01:00
6d843a0b65 users/frebib: add frebib-Cf SSH public key
Signed-off-by: Joe Groocock <me@frebib.net>
2020-07-19 15:00:06 +01:00
2b9420afa9 Manage salt-minion package, service and config
Restart the service after upgrading the package or modifying the minion
configuration file.

Signed-off-by: Joe Groocock <me@frebib.net>
2020-07-12 17:09:28 +01:00
4 changed files with 20 additions and 9 deletions

View File

@ -10,11 +10,11 @@ salt-minion:
- file: /etc/salt/minion
restart-salt-minion:
service.restart:
- name: salt-minion
cmd.run:
- name: sleep 10 && systemctl restart salt-minion
- bg: true
- order: last
- no_block: true
- watch:
- onchanges:
- pkg: salt-minion
- file: /etc/salt/minion
- require:
@ -22,17 +22,19 @@ restart-salt-minion:
/etc/salt/minion:
file.managed:
- source: salt://{{ slspath }}/minion.jinja
- source: salt://{{ slspath }}/templates/minion.jinja
- template: jinja
- user: root
- group: root
- mode: 644
- context:
- masters: {{ masters|json }}
masters: {{ masters|json }}
- require:
- pkg: salt-minion
check-minion-config:
cmd.run:
- name: sudo salt-call --local --skip-grains test.ping
- watch:
- name: sudo salt-call --local --skip-grains test.true
- onchanges:
- pkg: salt-minion
- file: /etc/salt/minion

View File

@ -1,4 +1,4 @@
id: {{ minion_id }}
id: {{ grains.id|lower }}
log_level: info
ipv6: true
ssl: true

View File

@ -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 %}

View File

@ -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: