共计 258 个字符,预计需要花费 1 分钟才能阅读完成。
假设一个主机有多个磁盘需要挂载时,可以使用with_item进行遍历来挂载,如以下task
- name: mount disks
mount:
name: "{{ item.name }}"
src: "{{ item.src }}"
fstype: "{{ item.fs }}"
# change to 'mounted' to auto mount
state: present
with_items:
- { name: /mnt/disk1, src: /dev/sda1, fs: ext4}
- { name: /mnt/disk2, src: /dev/sda2, fs: ext4}
正文完