Vendor Galaxy Roles and Collections
Some checks failed
/ Ansible Lint (push) Failing after 5m45s
/ Ansible Lint (pull_request) Failing after 4m59s

This commit is contained in:
Stefan Bethke 2026-02-06 22:07:16 +01:00
commit 2aed20393f
3553 changed files with 387444 additions and 2 deletions

View file

@ -0,0 +1,19 @@
debops.nfs - manage NFS4 client using Ansible
Copyright (C) 2013-2017 Maciej Delmanowski <drybjed@gmail.com>
Copyright (C) 2015-2017 DebOps <https://debops.org/>
SPDX-License-Identifier: GPL-3.0-only
This Ansible role is part of DebOps.
DebOps is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3, as
published by the Free Software Foundation.
DebOps is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DebOps. If not, see https://www.gnu.org/licenses/.

View file

@ -0,0 +1,98 @@
---
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
# .. Copyright (C) 2013-2017 Maciej Delmanowski <drybjed@gmail.com>
# .. Copyright (C) 2015-2017 DebOps <https://debops.org/>
# .. SPDX-License-Identifier: GPL-3.0-only
# .. _nfs__ref_defaults:
# debops.nfs default variables [[[
# ================================
# .. contents:: Sections
# :local:
#
# .. include:: ../../../../includes/global.rst
# APT packages [[[
# ----------------
# .. envvar:: nfs__base_packages [[[
#
# List of APT packages that are required for NFS support.
nfs__base_packages: [ 'nfs-common' ]
# ]]]
# .. envvar:: nfs__packages [[[
#
# List of additional APT packages to install with NFS support.
nfs__packages: []
# ]]]
# ]]]
# NFS mount configuration [[[
# ---------------------------
# .. envvar:: nfs__kerberos [[[
#
# Enable Kerberos support. Currently doesn't do much.
nfs__kerberos: False
# ]]]
# .. envvar:: nfs__default_mount_type [[[
#
# The default filesystem type used for NFS mount points, if a custom type is
# not specified in the NFS share configuration.
nfs__default_mount_type: 'nfs4'
# ]]]
# .. envvar:: nfs__base_mount_options [[[
#
# List of :command:`mount` options that are added to all mount points
# configured by this role. These should ensure correct operation for a network
# mount point.
nfs__base_mount_options: [ 'proto=tcp', 'port=2049', '_netdev' ]
# ]]]
# .. envvar:: nfs__security_mount_options [[[
#
# List of :command:`mount` options related to Kerberos security, added to all
# mount points configured by this role.
nfs__security_mount_options: '{{ ["sec=krb5p"] if nfs__kerberos | bool else ["sec=sys"] }}'
# ]]]
# .. envvar:: nfs__default_mount_options [[[
#
# List of default :command:`mount` options added to all mount point configured
# by this role if no options are specified in the configuration of a given NFS
# share.
nfs__default_mount_options: [ 'noatime', 'nosuid', 'nodev', 'hard', 'intr' ]
# ]]]
# ]]]
# NFS shares [[[
# --------------
# The lists of NFS shares configured on the hosts. Each list element is
# a dictionary which describes an NFS share. See :ref:`nfs__ref_shares` for
# more details.
# .. envvar:: nfs__shares [[[
#
# List of NFS shares configured on all hosts in the Ansible inventory.
nfs__shares: []
# ]]]
# .. envvar:: nfs__group_shares [[[
#
# List of NFS shares configured on hosts in specific Ansible inventory group.
nfs__group_shares: []
# ]]]
# .. envvar:: nfs__host_shares [[[
#
# List of NFS shares configured on specific hosts in the Ansible inventory.
nfs__host_shares: []
# ]]]
# ]]]
# ]]]

View file

@ -0,0 +1,31 @@
---
# Copyright (C) 2013-2017 Maciej Delmanowski <drybjed@gmail.com>
# Copyright (C) 2015-2022 DebOps <https://debops.org/>
# SPDX-License-Identifier: GPL-3.0-only
# Ensure that custom Ansible plugins and modules included in the main DebOps
# collection are available to roles in other collections.
collections: [ 'debops.debops' ]
dependencies: []
galaxy_info:
author: 'Maciej Delmanowski'
description: 'Configure NFS4 client'
company: 'DebOps'
license: 'GPL-3.0-only'
min_ansible_version: '2.2.0'
platforms:
- name: 'Ubuntu'
versions: [ 'all' ]
- name: 'Debian'
versions: [ 'all' ]
galaxy_tags:
- nfs
- filesystem
- networking

View file

@ -0,0 +1,60 @@
---
# Copyright (C) 2013-2017 Maciej Delmanowski <drybjed@gmail.com>
# Copyright (C) 2015-2017 DebOps <https://debops.org/>
# SPDX-License-Identifier: GPL-3.0-only
- name: Install required packages
ansible.builtin.package:
name: '{{ q("flattened", (nfs__base_packages
+ nfs__packages)) }}'
state: 'present'
register: nfs__register_packages
until: nfs__register_packages is succeeded
- name: Configure NFS client
ansible.builtin.template:
src: '{{ item }}.j2'
dest: '/{{ item }}'
owner: 'root'
group: 'root'
mode: '0644'
with_items:
- 'etc/default/nfs-common'
register: nfs__register_config
- name: Ensure that the NFS mount points exist
ansible.builtin.file:
path: '{{ item.path }}'
owner: '{{ item.owner | d("root") }}'
group: '{{ item.group | d("root") }}'
mode: '{{ item.mode | d("0755") }}'
state: 'directory'
loop: '{{ q("flattened", nfs__shares
+ nfs__group_shares
+ nfs__host_shares) }}'
when: item.path | d() and item.src | d() and item.state | d('mounted') == 'present'
- name: Manage NFS mount points
ansible.posix.mount:
name: '{{ item.path }}'
src: '{{ item.src }}'
fstype: '{{ item.fstype | d(nfs__default_mount_type) }}'
opts: '{{ lookup("template", "lookup/mount_options.j2") | from_yaml }}'
state: '{{ item.state | d("mounted") }}'
passno: '{{ item.passno | d(omit) }}'
dump: '{{ item.dump | d(omit) }}'
fstab: '{{ item.fstab | d(omit) }}'
loop: '{{ q("flattened", nfs__shares
+ nfs__group_shares
+ nfs__host_shares) }}'
register: nfs__register_devices
when: item.path | d() and item.src | d()
- name: Restart 'remote-fs.target' systemd unit
ansible.builtin.systemd: # noqa no-handler
name: 'remote-fs.target'
state: 'restarted'
daemon_reload: True
loop: '{{ nfs__register_devices.results }}'
when: (ansible_service_mgr == 'systemd' and item is changed and
(lookup("template", "lookup/mount_options.j2") is match(".*x-systemd.automount.*")))

View file

@ -0,0 +1,25 @@
{# Copyright (C) 2013-2017 Maciej Delmanowski <drybjed@gmail.com>
# Copyright (C) 2015-2017 DebOps <https://debops.org/>
# SPDX-License-Identifier: GPL-3.0-only
#}
# {{ ansible_managed }}
# If you do not set values for the NEED_ options, they will be attempted
# autodetected; this should be sufficient for most people. Valid alternatives
# for the NEED_ options are "yes" and "no".
# Do you want to start the statd daemon? It is not needed for NFSv4.
NEED_STATD="no"
# Options for rpc.statd.
# Should rpc.statd listen on a specific port? This is especially useful
# when you have a port-based firewall. To use a fixed port, set this
# this variable to a statd argument like: "--port 4000 --outgoing-port 4001".
# For more information, see rpc.statd(8) or https://wiki.debian.org/SecuringNFS
STATDOPTS=""
# Do you want to start the idmapd daemon? It is only needed for NFSv4.
NEED_IDMAPD="yes"
# Do you want to start the gssd daemon? It is required for Kerberos mounts.
NEED_GSSD="{{ 'yes' if nfs__kerberos | bool else 'no' }}"

View file

@ -0,0 +1,17 @@
{# Copyright (C) 2013-2020 Maciej Delmanowski <drybjed@gmail.com>
# Copyright (C) 2015-2020 DebOps <https://debops.org/>
# SPDX-License-Identifier: GPL-3.0-only
#}
{% set nfs__tpl_mount_options = [] %}
{% if item.options | d() %}
{% set _ = nfs__tpl_mount_options.extend((item.options.split(',') if item.options is string else item.options)) %}
{% elif item.opts | d() %}
{% set _ = nfs__tpl_mount_options.extend((item.opts.split(',') if item.opts is string else item.opts)) %}
{% else %}
{% set _ = nfs__tpl_mount_options.extend((nfs__default_mount_options.split(',') if nfs__default_mount_options is string else nfs__default_mount_options)) %}
{% endif %}
{% if (item.default_options | d(True)) | bool %}
{{ (nfs__security_mount_options + nfs__tpl_mount_options + nfs__base_mount_options) | unique | join(',') | to_yaml }}
{% else %}
{{ (nfs__tpl_mount_options + [ '_netdev' ]) | unique | join(',') | to_yaml }}
{% endif %}