挂载sdb-sdg硬盘格式化为xfs文件系统,并挂载到/data1-data6的ansible的yml文件
时间: 2024-05-19 18:14:50 浏览: 139
ubuntu挂载硬盘-linux系统操作技巧
- name: Format and mount sdb-sdg to /data1-data6
hosts: all
become: true
tasks:
- name: Create mount points
file:
path: "/data{{ item }}"
state: directory
with_sequence: start=1 end=6
- name: Format disks to XFS
filesystem:
fstype: xfs
dev: "/dev/sd{{ item }}"
with_items:
- b
- c
- d
- e
- f
- g
- name: Mount disks to mount points
mount:
path: "/data{{ item.0 }}"
src: "/dev/sd{{ item.1 }}"
fstype: xfs
state: mounted
with_together:
- "{{ range(1,7)|list }}"
- [b, c, d, e, f, g]
阅读全文