arensb.truenas.jail_fstab module – Manage a jail’s fstab
Note
This module is part of the arensb.truenas collection (version 1.11.4).
To install it, use: ansible-galaxy collection install arensb.truenas
.
To use it in a playbook, specify: arensb.truenas.jail_fstab
.
New in arensb.truenas 1.9.0
Synopsis
Add, remove, mount, and unmount filesystems that a jail sees.
Note that changes can only be made when the jail is stopped, so this module will attempt to stop the jail if it needs to, and then restart it after the changes are made.
If you do not want production jails to be restarted without your explicit approval, you can add a clause like
check_mode: "{{ restart_jails != 'yes' }}"
Parameters
Parameter |
Comments |
---|---|
If If Choices:
|
|
List of mount points. Each element is a dictionary. Most people will only need to specify |
|
Used by the This is the For a jail, this will typically be 0. Default: |
|
Used by This is not normally useful in a jail. It is included here for completeness. Default: |
|
Filesystem type. When mounting an existing directory, use Default: |
|
The directory where the device should be mounted. This is a relative path, relative to the jail’s root, typically |
|
Filesystem options to pass to The most common values are Default: |
|
The device to mount, or the directory to share with the jail. |
|
Whether the filesystem should be mounted or not. Set By default, filesystems are mounted, because it is assumed that you want them available. In addition, setting When Choices:
|
|
Name of the jail |
Examples
- name: Mount some directories inside a jail
arensb.truenas.jail_fstab:
jail: the-jail-name
fstab:
- src: /mnt/data/my-data
mount: /my-data
fstype: nullfs
options: ro
dump: 0
pass: 0
- src: /mnt/data/more-data
mount: /data/more
# Making changes to fstab involves stopping the jail, then restarting it.
# This shows how to not affect running services unless the 'bounce_jails'
# variable is set to 'yes'.
- name: Don't halt production services
arensb.truenas.jail_fstab:
jail: the-jail-name
fstab:
- src: /mnt/data/my-data
mount: /my-data
check_mode: "{{ ansible_check_mode or bounce_jails != 'yes' }}"
- name: Ensure that a filesystem is *not* mounted:
arensb.truenas.jail_fstab:
jail: the-jail-name
fstab:
- mount: /old-data
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
In check mode, this is a detailed list of changed that would be made. Returned: success |
|
The fstab of the jail fstab. This is a dict of elements of the form
Returned: success |
|
This module may affect multiple filesystems. For a successful change, this is typically Returned: success |