cmprescott.autofs

Ansible 角色:autofs

构建状态

安装和配置 autofs。

要求

# Ansible 版本 1.4.4+
ansible --version

# 操作系统
case $OSTYPE in
  # Linux 需要 apt|yum|dnf|zypper
  "linux"*)
      apt --version||yum --version||dnf --version||zypper --version;;
  # OS X 不需要额外设置
  "darwin"*)
      echo autofs 是开箱即用的;;
esac

角色变量

# --- autofs 配置 ---
autofs_indirect_maps:
  - name: autofs.nfs
    path: /mnt/nfs
    mark: "用于幂等性(unique identifier)"
    options: "--timeout=30 --ghost"
    mounts:
      - name: "isos"
        fstype: "nfs,rw,bg,hard,intr,tcp,resvport"
        url: "nfs.server.com:/data/isos"

# --- 操作系统设置 ---
# 不需要修改
autofs_pkgs:
  Linux: [ 'autofs' ]
  Darwin: []

# --- 操作系统配置 ---
# 不需要修改
autofs_master:
  Linux: "/etc/auto.master"
  Darwin: "/etc/auto_master"

依赖

无。

示例剧本

- name: "媒体客户端"
  hosts: clients.media
  roles:
    - name: "媒体客户端 | NFS | 确保自动挂载"
      become: true
      become_method: sudo
      role: cmprescott.autofs
      autofs_indirect_maps:

        - name: "auto.nfs-nas"
          path: "/mnt/nfs"
          mark: "来自 NAS 的 NFS 挂载"
          options: "--timeout=30 --ghost"
          mounts:
            - name: "电影"
              fstype: "nfs,rw,bg,hard,intr,tcp,resvport"
              url: "nfs.server.com:/data/movies"
            - name: "电视"
              fstype: "nfs,rw,bg,hard,intr,tcp,resvport"
              url: "nfs.server.com:/data/tv"

        - name: "auto.nfs-other"
          path: "/-"
          mark: "带根目录的 NFS 挂载"
          options: "--timeout=30 --ghost"
          mounts:
            - name: "/var/remotedir"
              fstype: "nfs,rw,bg,hard,intr,tcp,resvport"
              url: "nfs.server.com:/data/remotedir"

许可证

BSD

作者信息

Prescott Chris

安装
ansible-galaxy install cmprescott.autofs
许可证
Unknown
下载
21.6k
拥有者