【发布时间】:2017-09-29 15:40:41
【问题描述】:
我们在/etc/fstab 文件中为不同的服务器配置了不同的挂载点。我怎样才能使用 Ansible 达到同样的效果?
例如:
服务器 A 有一个 source node1:/data/col1/RMAN 安装在 path /mountPointA
以上我们可以使用Ansible的mount模块如
- name: Add Mount Points
mount:
path: /mnt/dvd
src : /dev/sr0
fstype: iso09660
opts: ro
boot: yes
state: present
但是
如果我有另一个服务器“B”,它的source /node1:/data/col1/directoryB 需要安装在path /mountPointB。但是,此服务器不需要配置第一个挂载点。
是否可以在单个 yml 文件中实现?
换句话说
Host source dest
hostA /source/directoryA /mnt
hostB /source/directoryB /mnt or /mnt/subdirectory #assuming subdir exists
我希望这是有道理的。对困惑感到抱歉。该剧本将在大量主机上运行,我如何确保自动选择正确的主机以使用正确的挂载点
【问题讨论】:
标签: ansible mount-point