refactor(service): split out nfs service handling into dedicated state

This commit is contained in:
Heinz Wiesinger 2020-09-21 11:18:20 +02:00
parent b3d113a49e
commit ad8d4b89dc
2 changed files with 17 additions and 9 deletions

View file

@ -1,9 +1,15 @@
{% from "nfs/map.jinja" import nfs with context %}
include:
- nfs.service
{% if nfs.pkgs_server %}
nfs-server-deps:
pkg.installed:
- pkgs: {{ nfs.pkgs_server|json }}
- require_in:
- service: nfs-service
{% endif %}
nfs-exports-configure:
@ -14,15 +20,6 @@ nfs-exports-configure:
- watch_in:
- service: nfs-service
nfs-service:
service.running:
{% if nfs.service_name is string %}
- name: {{ nfs.service_name }}
{% elif nfs.service_name is iterable %}
- names: {{ nfs.service_name }}
{% endif %}
- enable: True
{% if grains.get('os') == 'FreeBSD' %}
{% set mountd_flags = salt['pillar.get'](
'nfs:server:mountd_flags', None) -%}

11
nfs/service.sls Normal file
View file

@ -0,0 +1,11 @@
{% from "nfs/map.jinja" import nfs with context %}
nfs-service:
service.running:
{% if nfs.service_name is string %}
- name: {{ nfs.service_name }}
{% elif nfs.service_name is iterable %}
- names: {{ nfs.service_name }}
{% endif %}
- enable: True