centos7 使用ansible批量挂载硬盘
- name: Yum Installyum: name="{{ item }}" state=latest #下载ansible 依赖
with_items:
- libselinux-python
become: yes
become_method: su
- name: New Disk Partition
script: disk.sh "{{ disk }}" # 执行 disk.sh 参数{{ disk }} 对应xfs.yml的disk:/dev/vdb #磁盘名字
become: yes
become_method: su
- name: New Disk Format(xfs)
filesystem: fstype=xfs dev="{{ partition }}" #分区格式并格式化
become: yes
become_method: su
- name: New Disk Mount # 挂载磁盘并写入/etc/fstab
mount: name="{{ mountDir }}" src="{{ partition }}" fstype=xfs state=mounted
become: yes
become_method: su
页:
[1]