Skip to content

Instantly share code, notes, and snippets.

@kestel
Created May 25, 2020 07:23
Show Gist options
  • Save kestel/f1a9b75119c2e22e95b7c56a8199cf38 to your computer and use it in GitHub Desktop.
Save kestel/f1a9b75119c2e22e95b7c56a8199cf38 to your computer and use it in GitHub Desktop.
Prepare DataDisk in Azure Linux VM with ansible
---
vars:
data_device: /dev/disk/azure/scsi1/lun0
data_disk_mount: /data
tasks:
- name: Setup data disk
become: true
block:
- name: Create partition on data disk
parted:
device: "{{data_device}}"
number: 1
state: present
- name: Create a ext4 fs on data disk
filesystem:
fstype: ext4
dev: "{{data_device}}-part1"
- name: Get UUID for partition
command: blkid -s UUID -o value "{{ data_device }}-part1"
register: disk_blkid
- name: Mount data disk
mount:
path: "{{data_disk_mount}}"
src: "UUID={{disk_blkid.stdout}}"
fstype: ext4
state: mounted
- name: Upgrade all packages
apt:
upgrade: dist
tags:
- disk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment