[deyu1@kvm19 ansible]$ ansible-doc filesystem | grep ^EX -A5 EXAMPLES: - name: Create a ext2 filesystem on /dev/sdb1 filesystem: fstype: ext2 dev: /dev/sdb1
[deyu1@kvm19 ansible]$ vim lvfs.yml [deyu1@kvm19 ansible]$ cat lvfs.yml --- - hosts: dev tasks: - name: Create a logical volume lvol: vg: fieldwork lv: test size: '100' - name: Create a ext4 filesystem: fstype: ext4 dev: /dev/fieldwork/test
[deyu1@kvm19 ansible]$ ansible-playbook lvfs.yml PLAY [dev] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [kvm11] TASK [Create a logical volume] ************************************************* ok: [kvm11] TASK [Create a ext4] *********************************************************** changed: [kvm11] PLAY RECAP ********************************************************************* kvm11 : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0