�
�Udac @` s$ d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d d
l Z d d l
m Z m Z d d l
m Z d d
l m Z d d l m Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d
d
d � Z d d � Z d � Z e d k r e � n d
S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust coret supported_bys
---
module: mount
short_description: Control active and configured mount points
description:
- This module controls active and configured mount points in C(/etc/fstab).
author:
- Ansible Core Team
- Seth Vidal (@skvidal)
version_added: "0.6"
options:
path:
description:
- Path to the mount point (e.g. C(/mnt/files)).
- Before Ansible 2.3 this option was only usable as I(dest), I(destfile) and I(name).
type: path
required: true
aliases: [ name ]
src:
description:
- Device to be mounted on I(path).
- Required when I(state) set to C(present) or C(mounted).
type: path
fstype:
description:
- Filesystem type.
- Required when I(state) is C(present) or C(mounted).
type: str
opts:
description:
- Mount options (see fstab(5), or vfstab(4) on Solaris).
type: str
dump:
description:
- Dump (see fstab(5)).
- Note that if set to C(null) and I(state) set to C(present),
it will cease to work and duplicate entries will be made
with subsequent runs.
- Has no effect on Solaris systems.
type: str
default: 0
passno:
description:
- Passno (see fstab(5)).
- Note that if set to C(null) and I(state) set to C(present),
it will cease to work and duplicate entries will be made
with subsequent runs.
- Deprecated on Solaris systems.
type: str
default: 0
state:
description:
- If C(mounted), the device will be actively mounted and appropriately
configured in I(fstab). If the mount point is not present, the mount
point will be created.
- If C(unmounted), the device will be unmounted without changing I(fstab).
- C(present) only specifies that the device is to be configured in
I(fstab) and does not trigger or require a mount.
- C(absent) specifies that the device mount's entry will be removed from
I(fstab) and will also unmount the device and remove the mount
point.
- C(remounted) specifies that the device will be remounted for when you
want to force a refresh on the mount itself (added in 2.9). This will
always return changed=true.
type: str
required: true
choices: [ absent, mounted, present, unmounted, remounted ]
fstab:
description:
- File to use instead of C(/etc/fstab).
- You should not use this option unless you really know what you are doing.
- This might be useful if you need to configure mountpoints in a chroot environment.
- OpenBSD does not allow specifying alternate fstab files with mount so do not
use this on OpenBSD with any state that operates on the live filesystem.
- This parameter defaults to /etc/fstab or /etc/vfstab on Solaris.
type: str
boot:
description:
- Determines if the filesystem should be mounted on boot.
- Only applies to Solaris systems.
type: bool
default: yes
version_added: '2.2'
backup:
description:
- Create a backup file including the timestamp information so you can get
the original file back if you somehow clobbered it incorrectly.
type: bool
default: no
version_added: '2.5'
notes:
- As of Ansible 2.3, the I(name) option has been changed to I(path) as
default, but I(name) still works as well.
s�
# Before 2.3, option 'name' was used instead of 'path'
- name: Mount DVD read-only
mount:
path: /mnt/dvd
src: /dev/sr0
fstype: iso9660
opts: ro,noauto
state: present
- name: Mount up device by label
mount:
path: /srv/disk
src: LABEL=SOME_LABEL
fstype: ext4
state: present
- name: Mount up device by UUID
mount:
path: /home
src: UUID=b3e48f45-f933-4c8e-a700-22a159ec9077
fstype: xfs
opts: noatime
state: present
- name: Unmount a mounted volume
mount:
path: /tmp/mnt-pnt
state: unmounted
- name: Mount and bind a volume
mount:
path: /system/new_volume/boot
src: /boot
opts: bind
state: mounted
fstype: none
N( t
AnsibleModulet get_platform( t ismount( t iteritems( t to_nativec C` sb | j d r | j | � n t | d � } x | D] } | j | � q3 W| j � | j � d S( Nt backupt w( t paramst backup_localt opent writet flusht close( t modulet linest patht fs_wt l( ( s@ /usr/lib/python2.7/site-packages/ansible/modules/system/mount.pyt write_fstab� s
c C` s? t | t � r | S| j d d � j d d � j d d � Sd S( sh Escape invalid characters in fstab fields.
space (040)
ampersand (046)
backslash (134)
s \s \134t s \040t &s \046N( t
isinstancet intt replace( t v( ( s@ /usr/lib/python2.7/site-packages/ansible/modules/system/mount.pyt
_escape_fstab� s c C` s9 g } t } t } t g t | � D] \ } } | t | � f ^ q"