ansible版本以及python版本,建议使用python3以后的版本···
[root@yunwei ~]# ansible --version
ansible 2.8.4
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Aug 7 2019, 00:51:29) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
1、格式化磁盘:
ansible all -m filesystem -a "fstype=xfs dev=/dev/vdb"
2、创建挂载:
ansible all -m mount -a 'path=/data src=/dev/vdb fstype=xfs state=mounted opts=rw'
其中state的可选值为:absent\mounted\umounted ,一般正常选取mounted 模式就好。
然后 df -h ,以及cat /etc/fstab可以确定信息。