远程格式化其他主机上硬盘


用法选项

[root@ansible ~]# ansible-doc -s filesystem
less 436
Copyright (C) 1984-2009 Mark Nudelman
less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Homepage: http://www.greenwoodsoftware.com/less
- name: Makes file system on block device
  action: filesystem
      dev=                   # Target block device.
      force                  # If yes, allows to create new filesystem on devices that already has filesystem.
      fstype=                # File System type to be created.
      opts                   # List of options to be passed to mkfs command.
      resizefs               # If yes, if the block device and filessytem size differ, grow the filesystem into the space. Note,
                               XFS Will only grow if mounted.

选项:

 dev:目标块设备

 force:在一个已有文件系统的设备上强制创建

 fstype:文件系统的类型

 opts:传递给mkfs命令的选项


查看远程主机上硬盘类型是/dev/sdb

wKioL1cnXeSjwyQcAAOvf2tzqc8144.jpg



格式化,挂载。并会写入fstab文件。。

wKiom1cnYgvg-cBaAAMArzXu1nI867.jpg


查看fstab文件

wKioL1cnY1SBPDI2AAL4YAWVk2c112.jpg

mount用法选项,使用ansible-doc -s mount来查看更多的方法。先这样吧。睡觉觉去了。