Ansible Role: serdigital64.storage.stg_nfs_client¶
Purpose¶
Manage the Linux NFS client
Supported features in the current version:
- Prepare environment:
- Create main mount point path
- Deploy service. Packages are defined in the variable
stg_nfs_client_profiles
. - Provision mounts:
- Create mount point
- Add entry to local fstab
- Set mount state (mounted,unmounted)
The stg_nfs_client Ansible-Role is part of the A:Platform64 project and is available in the storage Ansible-Collection.
Usage¶
The following example is an Ansible Playbook that includes all the supported features:
use this link if viewing the doc on github
---
- name: "Storage / NFS / Client / Usage example"
hosts: "localhost"
gather_facts: true
# Warning: in order for the playbook to run adjust the import definition to use an up&running NFS server
tasks:
- name: "Example: install nfs, configure and mount remote shares"
vars:
stg_nfs_client:
resolve_prereq: true
prepare: true
deploy: true
provision: true
stg_nfs_client_imports:
- name: "test-share"
mount: "test-share"
server: "nfs-serverx"
share: "remote-share"
options: "ro"
mounted: "true"
ansible.builtin.include_role:
name: "serdigital64.storage.stg_nfs_client"
...
The playbook can be run by executing:
# Set ANSIBLE_COLLECTIONS_PATHS to the default location. Change as needed.
ANSIBLE_COLLECTIONS_PATHS="${HOME}/.ansible/collections"
ansible-playbook "${ANSIBLE_COLLECTIONS_PATHS}/ansible_collections/serdigital64/storage/playbooks/stg_nfs_client.yml"
Role Parameters¶
Actions¶
- Use action-parameters to control what tasks are enabled for the role to execute.
- Parameters should be declared as task level vars as they are intented to be dynamic.
stg_nfs_client:
resolve_prereq:
prepare:
deploy:
provision:
Parameter | Required? | Type | Default | Purpose / Value |
---|---|---|---|---|
stg_nfs_client.resolve_prereq | no | boolean | false | Enable automatic resolution of prequisites |
stg_nfs_client.prepare | no | boolean | false | Enable environment preparation |
stg_nfs_client.deploy | no | boolean | false | Enable installation of application packages |
stg_nfs_client.provision | no | boolean | false | Enable provisioning of application components |
End State¶
- Use end-state parameters to define the target state after role execution.
- Parameters should be declared in host_vars or group_vars as they are intended to be permanent.
stg_nfs_client_application:
name:
type:
version:
installed:
stg_nfs_client_paths:
shares_root:
stg_nfs_client_imports:
- name:
mount:
server:
share:
options:
owner:
group:
mode:
mounted:
Parameter | Required? | Type | Default | Purpose / Value |
---|---|---|---|---|
stg_nfs_client_application | yes(deploy) | dictionary | Set application package end state | |
stg_nfs_client_application.name | yes | string | "nfs_client" | Select application package name |
stg_nfs_client_application.type | yes | string | "distro" | Select application package type |
stg_nfs_client_application.version | yes | string | "latest" | Select application package version |
stg_nfs_client_application.installed | yes | boolean | true | Set application package end state |
stg_nfs_client_paths | yes(prepare) | dictionary | Set paths | |
stg_nfs_client_paths.shares_root | yes | string | "/srv/nfs-client" | Location where mounts will be created |
stg_nfs_client_imports | yes(provision) | list | ||
stg_nfs_client_imports.0.name | no | string | Share name | |
stg_nfs_client_imports.0.mount | yes | string | Local path where the share will be mounted. Relative to the root_path | |
stg_nfs_client_imports.0.server | yes | string | FQDN of the server exporting the share | |
stg_nfs_client_imports.0.share | yes | string | Remote share path | |
stg_nfs_client_imports.0.options | yes | string | Local mount options | |
stg_nfs_client_imports.0.owner | no | string | "root" | Mount path owner |
stg_nfs_client_imports.0.group | no | string | "root" | Mount path group |
stg_nfs_client_imports.0.mode | no | string | "755 | Mount path mode |
stg_nfs_client_imports.0.mounted | no | boolean | true | Mount the share? |
Deployment¶
OS Compatibility¶
The operating system compatibility list is defined in the variable: stg_nfs_client_platforms
Dependencies¶
- Ansible Collections:
- serdigital64.backup
- bkp_archive
- serdigital64.system
- sys_package
- sys_repository
- ansible.posix
- mount
- serdigital64.backup
Prerequisites¶
The Ansible engine must be already installed and configured for privileged access and remote execution.
In addition the following prerequisites can be automatically solved when running the playbook by setting the role action: resolve_prereq: true
- Package manager for the target application is installed and enabled.
Installation Procedure¶
Manually install Ansible Collections from the Ansible Galaxy repository:
ansible-galaxy collection install serdigital64.storage
Automatic installation is also available by deploying A:Platform64
Contributing¶
Help on implementing new features and maintaining the code base is welcomed.
Please see the guidelines for further details.