zos_mount – Mount a z/OS file system.

Synopsis

  • The module zos_mount can manage mount operations for a z/OS UNIX System Services (USS) file system data set.

  • The src data set must be unique and a Fully Qualified Name (FQN).

  • The path will be created if needed.

Parameters

path

The absolute path name onto which the file system is to be mounted.

The path is case sensitive and must be less than or equal 1023 characters long.

required: True
type: str
src

The name of the file system to be added to the file system hierarchy.

The file system src must be a data set of type fs_type.

The file system src data set must be cataloged.

required: True
type: str
fs_type

The type of file system that will be mounted.

The physical file systems data set format to perform the logical mount.

The fs_type is required to be uppercase.

required: True
type: str
choices: HFS, ZFS, NFS, TFS
state

The desired status of the described mount (choice).

If state=mounted and src are not in use, the module will add the file system entry to the parmlib member persistent/data_store if not present. The path will be updated, the device will be mounted and the module will complete successfully with changed=True.

If state=mounted and src are in use, the module will add the file system entry to the parmlib member persistent/data_store if not present. The path will not be updated, the device will not be mounted and the module will complete successfully with changed=False.

If state=unmounted and src are in use, the module will not add the file system entry to the parmlib member persistent/data_store. The device will be unmounted and the module will complete successfully with changed=True.

If state=unmounted and src are not in use, the module will not add the file system entry to parmlib member persistent/data_store.The device will remain unchanged and the module will complete with changed=False.

If state=present, the module will add the file system entry to the provided parmlib member persistent/data_store if not present. The module will complete successfully with changed=True.

If state=absent, the module will remove the file system entry to the provided parmlib member persistent/data_store if present. The module will complete successfully with changed=True.

If state=remounted, the module will not add the file system entry to parmlib member persistent/data_store. The device will be unmounted and mounted, the module will complete successfully with changed=True.

required: False
type: str
default: mounted
choices: absent, mounted, unmounted, present, remounted
persistent

Add or remove mount command entries to provided data_store

required: False
type: dict
data_store

The data set name used for persisting a mount command. This is usually BPXPRMxx or a copy.

required: True
type: str
backup

Creates a backup file or backup data set for data_store, including the timestamp information to ensure that you retrieve the original parameters defined in data_store.

backup_name can be used to specify a backup file name if backup=true.

The backup file name will be returned on either success or failure of module execution such that data can be retrieved.

required: False
type: bool
default: False
backup_name

Specify the USS file name or data set name for the destination backup.

If the source data_store is a USS file or path, the backup_name name can be relative or absolute for file or path name.

If the source is an MVS data set, the backup_name must be an MVS data set name.

If the backup_name is not provided, the default backup_name will be used. If the source is a USS file or path, the name of the backup file will be the source file or path name appended with a timestamp. For example, /path/file_name.2020-04-23-08-32-29-bak.tar.

If the source is an MVS data set, it will be a data set with a random name generated by calling the ZOAU API. The MVS backup data set recovery can be done by renaming it.

required: False
type: str
comment

If provided, this is used as a comment that surrounds the command in the persistent/data_store

Comments are used to encapsulate the persistent/data_store entry such that they can easily be understood and located.

required: False
type: list
elements: str
unmount_opts

Describes how the unmount will be performed.

For more on coded character set identifiers, review the IBM documentation topic UNMOUNT - Remove a file system from the file hierarchy.

required: False
type: str
default: NORMAL
choices: DRAIN, FORCE, IMMEDIATE, NORMAL, REMOUNT, RESET
mount_opts

Options available to the mount.

If mount_opts=RO on a mounted/remount, mount is performed read-only.

If mount_opts=SAME and (unmount_opts=REMOUNT), mount is opened in the same mode as previously opened.

If mount_opts=NOWAIT, mount is performed asynchronously.

If mount_opts=NOSECURITY, security checks are not enforced for files in this file system.

required: False
type: str
default: RW
choices: RO, RW, SAME, NOWAIT, NOSECURITY
src_params

Specifies a parameter string to be passed to the file system type.

The parameter format and content are specified by the file system type.

required: False
type: str
tag_untagged

If present, tags get written to any untagged file.

When the file system is unmounted, the tags are lost.

If tag_untagged=NOTEXT none of the untagged files in the file system are automatically converted during file reading and writing.

If tag_untagged=TEXT each untagged file is implicitly marked as containing pure text data that can be converted.

If this flag is used, use of tag_ccsid is encouraged.

required: False
type: str
choices: TEXT, NOTEXT
tag_ccsid

Identifies the coded character set identifier (ccsid) to be implicitly set for the untagged file.

For more on coded character set identifiers, review the IBM documentation topic Coded Character Sets.

Specified as a decimal value from 0 to 65535. However, when TEXT is specified, the value must be between 0 and 65535.

The value is not checked as being valid and the corresponding code page is not checked as being installed.

Required when tag_untagged=TEXT.

required: False
type: int
allow_uid

Specifies whether the SETUID and SETGID mode bits on an executable in this file system are considered. Also determines whether the APF extended attribute or the Program Control extended attribute is honored.

If allow_uid=True the SETUID and SETGID mode bits are considered when a program in this file system is run. SETUID is the default.

If allow_uid=False the SETUID and SETGID mode bits are ignored when a program in this file system is run. The program runs as though the SETUID and SETGID mode bits were not set. Also, if you specify the NOSETUID option on MOUNT, the APF extended attribute and the Program Control Bit values are ignored.

required: False
type: bool
default: True
sysname

For systems participating in shared file system, sysname specifies the particular system on which a mount should be performed. This system will then become the owner of the file system mounted. This system must be IPLed with SYSPLEX(YES).

sysname is the name of a system participating in shared file system. The name must be 1-8 characters long; the valid characters are A-Z, 0-9, $, @, and #.

required: False
type: str
automove

These parameters apply only in a sysplex where systems are exploiting the shared file system capability. They specify what happens to the ownership of a file system when a shutdown, PFS termination, dead system takeover, or file system move occurs. The default setting is AUTOMOVE where the file system will be randomly moved to another system (no system list used).

automove=AUTOMOVE indicates that ownership of the file system can be automatically moved to another system participating in a shared file system.

automove=NOAUTOMOVE prevents movement of the file system’s ownership in some situations.

automove=UNMOUNT allows the file system to be unmounted in some situations.

required: False
type: str
default: AUTOMOVE
choices: AUTOMOVE, NOAUTOMOVE, UNMOUNT
automove_list

If(automove=AUTOMOVE), this option will be checked.

This specifies the list of servers to include or exclude as destinations.

None is a valid value, meaning ‘move anywhere’.

Indicator is either INCLUDE or EXCLUDE, which can also be abbreviated as I or E.

required: False
type: str
tmp_hlq

Override the default high level qualifier (HLQ) for temporary and backup datasets.

The default HLQ is the Ansible user used to execute the module and if that is not available, then the value TMPHLQ is used.

required: False
type: str

Examples

- name: Mount a filesystem.
  zos_mount:
    src: SOMEUSER.VVV.ZFS
    path: /u/omvsadm/core
    fs_type: ZFS
    state: mounted

- name: Unmount a filesystem.
  zos_mount:
    src: SOMEUSER.VVV.ZFS
    path: /u/omvsadm/core
    fs_type: ZFS
    state: unmounted
    unmount_opts: REMOUNT
    opts: same

- name: Mount a filesystem readonly.
  zos_mount:
    src: SOMEUSER.VVV.ZFS
    path: /u/omvsadm/core
    fs_type: ZFS
    state: mounted
    mount_opts: RO

- name: Mount a filesystem and record change in BPXPRMAA.
  zos_mount:
    src: SOMEUSER.VVV.ZFS
    path: /u/omvsadm/core
    fs_type: ZFS
    state: mounted
    persistent:
        data_store: SYS1.PARMLIB(BPXPRMAA)
        comment: For Tape2 project

- name: Mount a filesystem and record change in BPXPRMAA after backing up to BPXPRMAB.
  zos_mount:
    src: SOMEUSER.VVV.ZFS
    path: /u/omvsadm/core
    fs_type: ZFS
    state: mounted
    persistent:
        data_store: SYS1.PARMLIB(BPXPRMAA)
        backup: Yes
        backup_name: SYS1.PARMLIB(BPXPRMAB)
        comment: For Tape2 project

- name: Mount a filesystem ignoring uid/gid values.
  zos_mount:
    src: SOMEUSER.VVV.ZFS
    path: /u/omvsadm/core
    fs_type: ZFS
    state: mounted
    allow_uid: no

- name: Mount a filesystem asynchronously (don't wait for completion).
  zos_mount:
    src: SOMEUSER.VVV.ZFS
    path: /u/omvsadm/core
    fs_type: ZFS
    state: mounted
    opts: nowait

- name: Mount a filesystem with no security checks.
  zos_mount:
    src: SOMEUSER.VVV.ZFS
    path: /u/omvsadm/core
    fs_type: ZFS
    state: mounted
    mount_opts: NOSECURITY

- name: Mount a filesystem, limiting automove to 4 devices.
  zos_mount:
    src: SOMEUSER.VVV.ZFS
    path: /u/omvsadm/core
    fs_type: ZFS
    state: mounted
    automove: AUTOMOVE
    automove_list: I,DEV1,DEV2,DEV3,DEV9

- name: Mount a filesystem, limiting automove to all except 4 devices.
  zos_mount:
    src: SOMEUSER.VVV.ZFS
    path: /u/omvsadm/core
    fs_type: ZFS
    state: mounted
    automove: AUTOMOVE
    automove_list: EXCLUDE,DEV4,DEV5,DEV6,DEV7

Notes

Note

All data sets are always assumed to be cataloged.

If an uncataloged data set needs to be fetched, it should be cataloged first.

Uncataloged data sets can be cataloged using the zos_data_set module.

Return Values

path

The absolute path name onto which the file system is to be mounted.

returned: always
type: str
sample: /u/omvsadm/core
src

The file in z/OS that is to be mounted.

returned: always
type: str
sample: SOMEUSER.VVV.ZFS
fs_type

The type of file system that will perform the logical mount request.

returned: always
type: str
sample: ZFS
state

The desired status of the described mount.

returned: always
type: str
sample: mounted
persistent

Values the user provided as input.

returned: always
type: dict
data_store

The persistent store name where the mount was written to.

returned: always
type: str
sample: SYS1.FILESYS(BPXPRMAA)
backup

Indicates if a backup of destinattion was configured.

returned: always
type: bool
sample:
true
backup_name

The unique data set name for the destination backup.

returned: always
type: str
sample: SYS1.FILESYS(PRMAABAK)
comment

The text that was used in markers around the Persistent/data_store entry.

returned: always
type: list
sample:
[
    [
        "u\u0027I did this because..\u0027"
    ]
]
unmount_opts

Describes how the unmount is to be performed.

returned: changed and if state=unmounted
type: str
sample: DRAIN
mount_opts

Options available to the mount.

returned: whenever non-None
type: str
sample: RW,NOSECURITY
src_params

Specifies a parameter string to be passed to the file system type.

returned: whenever non-None
type: str
sample: D(101)
tag_untagged

Indicates if tags should be written to untagged files.

returned: whenever Non-None
type: str
sample: TEXT
tag_ccsid

CCSID for untagged files in the mounted file system.

returned: when tag_untagged is defined
type: int
sample: 819
allow_uid

Whether the SETUID and SETGID mode bits on executables in this file system are considered.

returned: always
type: bool
sample:
true
sysname

sysname specifies the particular system on which a mount should be performed.

returned: if Non-None
type: str
sample: MVSSYS01
automove

Specifies what happens to the ownership of a file system during a shutdown, PFS termination, dead system takeover, or when file system move occurs.

returned: if Non-None
type: str
sample: AUTOMOVE
automove_list

This specifies the list of servers to include or exclude as destinations.

returned: if Non-None
type: str
sample: I,SERV01,SERV02,SERV03,SERV04
msg

Failure message returned by the module.

returned: failure
type: str
sample: Error while gathering information
stdout

The stdout from the mount command.

returned: always
type: str
sample: MOUNT FILESYSTEM( ‘source-dataset’ ) MOUNTPOINT( ‘/uss-path’ ) TYPE( ZFS )
stderr

The stderr from the mount command.

returned: failure
type: str
sample: No such file or directory “/tmp/foo”
stdout_lines

List of strings containing individual lines from stdout.

returned: failure
type: list
sample:
[
    "u\"MOUNT FILESYSTEM( \u0027source-dataset\u0027 ) MOUNTPOINT( \u0027/uss-path\u0027 ) TYPE( ZFS )\""
]
stderr_lines

List of strings containing individual lines from stderr.

returned: failure
type: list
sample:
[
    {
        "u\"FileNotFoundError": "No such file or directory \u0027/tmp/foo\u0027\""
    }
]
cmd

The actual command that was run by the module.

returned: failure
type: str
sample: MOUNT FILESYSTEM( ‘EXAMPLE.DATA.SET’ ) MOUNTPOINT( ‘/u/omvsadm/sample’ ) TYPE( ZFS )
rc

The return code of the mount command, if applicable.

returned: failure
type: int
sample: 8