robertdebock.autofs

Ansible 角色 autofs

在你的系统上安装和配置 autofs。

GitHub GitLab 下载 版本
github gitlab downloads Version

示例剧本

这个示例来自 molecule/default/converge.yml,并在每次推送、拉取请求和发布时进行测试。

---
- name: Converge
  hosts: all
  become: true
  gather_facts: true

  roles:
    - role: robertdebock.autofs
      autofs_maps:
        - mountpoint: /bind/mnt
          options:
            - "--timeout 60"
          directories:
            - path: mount
              server: ":/mnt"
              options:
                - "fstype=bind"
        - name: direct-mounts
          mountpoint: /-
          options:
            - "--timeout 60"
            - "--ghost"
          directories:
            - path: /bind/direct/mount
              server: ":/mnt"
              options:
                - "fstype=bind"
        - mountpoint: /do_not_exist
          state: absent
      nis_master_map: auto.master

机器需要准备。在 CI 中,这一步通过 molecule/default/prepare.yml 完成:

---
- name: Prepare
  hosts: all
  become: true
  gather_facts: false

  roles:
    - role: robertdebock.bootstrap

还可以参阅 完整的解释和示例 来了解如何使用这些角色。

角色变量

变量的默认值在 defaults/main.yml 中设置:

---
# autofs 的默认文件

# 路径中的第一个斜杠会被移除,所有剩余的斜杠将被这个字符替换。
#   示例: mountpoint=/bind/mount & autofs_slash_replace_char="-"
#   输出文件名: /etc/auto.bind-mount(移除前导斜杠,剩余部分替换为“-”)
autofs_slash_replace_char: "-"

# 如果你只想配置,但不想启动 autofs,可以将其设置为 "stopped"。
autofs_service_state: "started"

# 在这里你可以配置自动挂载的挂载点。
# autofs_maps:
#   - mountpoint: /home
#     directories:
#       - path: "*"
#         server: "server.example.com/&"
#   - mountpoint: /net
#     options:
#       - "--timeout=60"
#     directories:
#       - path: server
#         options:
#           - rw
#           - soft
#           - intr
#           - rsize=8192
#           - wsize=8192
#         server: "server.example.com:/"
#   - name: cifs-mounts  # 可选名称映射(用于文件名)。
#     mountpoint: /cifs
#     directories:
#       - path: data
#         options:
#           - fstype=cifs
#         server: "://server.example.com/sharename/"
#   - mountpoint: /fuse
#     directories:
#       - path: ftpserver
#         options:
#           - fstype=curl
#           - rw
#           - allow_others
#           - nodev
#           - nonempty
#           - noatime
#         server: ':ftp\://username\:password\@ftp.example.com'
#   - mountpoint: /do_not_exist
#     state: absent

# 设置 nis_master_map。
# nis_master_map: auto.master

需求

使用的角色状态

以下角色用于准备系统。你可以以其他方式准备你的系统。

要求 GitHub GitLab
robertdebock.bootstrap Build Status GitHub Build Status GitLab

上下文

这个角色是许多兼容角色的一部分。有关更多信息,请查看 这些角色的文档

以下是相关角色的概览: 依赖关系

兼容性

此角色已在以下 容器镜像 上进行测试:

容器 标签
Debian bullseye
EL 9
Fedora 所有
Ubuntu 所有

所需的最低 Ansible 版本为 2.12,测试已在:

  • 以前版本。
  • 当前版本。
  • 开发版本。

如果你发现问题,请在 GitHub 上登记。

许可证

Apache-2.0

作者信息

robertdebock

请考虑 赞助我

关于项目

Install and configure autofs on your system.

安装
ansible-galaxy install robertdebock.autofs
许可证
apache-2.0
下载
89.1k
拥有者
I know my way around (Linux) infrastructure, have a passion for automation, Docker, Ansible, Molecule and ci/cd.