Skip to content

Instantly share code, notes, and snippets.

@qrtt1
Created December 22, 2014 05:50
Show Gist options
  • Save qrtt1/19846df6e3013768a875 to your computer and use it in GitHub Desktop.
Save qrtt1/19846df6e3013768a875 to your computer and use it in GitHub Desktop.
mount data disk
---
- name: mount data disk
mount: name=/opt src=/dev/sdc1 fstype=ext4 state=mounted
register: try_mount_disk
ignore_errors: True
- command: parted -s /dev/sdc mklabel gpt
when: try_mount_disk | failed
- command: parted -s /dev/sdc mkpart primary ext4 0 100%
when: try_mount_disk | failed
- command: mkfs.ext4 /dev/sdc1
when: try_mount_disk | failed
- mount: name=/opt src=/dev/sdc1 fstype=ext4 state=mounted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment