Skip to content

Instantly share code, notes, and snippets.

@jonathanmedd
Created November 28, 2019 17:17
Show Gist options
  • Save jonathanmedd/c1a47ac447bd3125c1fceeacdb83395a to your computer and use it in GitHub Desktop.
Save jonathanmedd/c1a47ac447bd3125c1fceeacdb83395a to your computer and use it in GitHub Desktop.
_8_initialize-partition-format-disk.yml
---
- hosts: all
tasks:
- name: Get disk facts
win_disk_facts:
- name: Initialize Disk
win_shell: "Initialize-Disk -Number {{ disk_number }}"
when: ansible_disks[disk_number].guid is none
- name: Create Partition using all available space
win_partition:
drive_letter: "{{ drive_letter }}"
partition_size: -1
disk_number: "{{ disk_number }}"
when: ansible_disks[disk_number].guid is none
- name: Format the partition as NTFS and label it
win_format:
drive_letter: "{{ drive_letter }}"
file_system: NTFS
new_label: Data
when: ansible_disks[disk_number].guid is none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment