mirror of
https://github.com/saltstack-formulas/nfs-formula.git
synced 2025-04-17 10:10:31 +00:00
Merge pull request #4 from myii/PR_add-nfs-unmount
Add ability to unmount nfs shares
This commit is contained in:
commit
32015e2d1f
4 changed files with 51 additions and 0 deletions
18
README.md
18
README.md
|
@ -16,3 +16,21 @@ Install nfs server components
|
|||
---------------
|
||||
|
||||
Install nfs client components
|
||||
|
||||
``nfs.mount``
|
||||
---------------
|
||||
|
||||
Mount nfs shares via. pillar using the following parameters:
|
||||
* mountpoint
|
||||
* location
|
||||
* opts: default => "vers=3"
|
||||
* persist: default => True
|
||||
* mkmnt: default => True
|
||||
|
||||
``nfs.unmount``
|
||||
---------------
|
||||
|
||||
Unmount nfs shares via. pillar using the following parameters:
|
||||
* mountpoint
|
||||
* location
|
||||
* persist: default => False
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
########################################################################
|
||||
# File managed by Salt at <{{ source }}>.
|
||||
# Your changes will be overwritten.
|
||||
########################################################################
|
||||
#
|
||||
{% for dir, opts in salt['pillar.get']('nfs:server:exports').items() -%}
|
||||
{{ dir }} {{ opts }}
|
||||
{% endfor -%}
|
||||
|
|
23
nfs/unmount.sls
Normal file
23
nfs/unmount.sls
Normal file
|
@ -0,0 +1,23 @@
|
|||
{% from "nfs/map.jinja" import nfs with context %}
|
||||
|
||||
include:
|
||||
- nfs.client
|
||||
|
||||
# Parameter device for mount.unmounted: New in version 2015.5.0.
|
||||
# Errors: if not used with newer minions
|
||||
# Warnings: if used with older minions
|
||||
# Using the following values followed by the conditional avoids both issues
|
||||
{% set version_year = grains.saltversioninfo[0] %}
|
||||
{% set version_month = grains.saltversioninfo[1] %}
|
||||
{% set min_year = 2015 %}
|
||||
{% set min_month = 5 %}
|
||||
{% set use_device = (version_year > min_year or (version_year == min_year and version_month >= min_month)) %}
|
||||
|
||||
{% for m in salt['pillar.get']('nfs:unmount').iteritems() %}
|
||||
{{ m[1].mountpoint }}:
|
||||
mount.unmounted:
|
||||
{% if use_device %}
|
||||
- device: {{ m[1].location }}
|
||||
{% endif %}
|
||||
- persist: {{ m[1].persist|default('False') }}
|
||||
{% endfor %}
|
|
@ -9,4 +9,9 @@ nfs:
|
|||
opts: "vers=3,rsize=65535,wsize=65535"
|
||||
persist: True
|
||||
mkmnt: True
|
||||
unmount:
|
||||
someothername:
|
||||
mountpoint: "/some/other/path"
|
||||
location: "hostname:/other/path"
|
||||
persist: False
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue