I can do it separate but cannot combine them together, since I don't know disk device name.
My configuration:
- name: Create Virtual Machine
azure_rm_virtualmachine:
resource_group: "{{ resource_group }}"
name: "{{ item }}"
vm_size: "{{ flavor }}"
managed_disk_type: "{{ disks.disk_type }}"
network_interface_names: "NIC-{{ item }}"
ssh_password_enabled: false
admin_username: "{{ cloud_config.admin_username }}"
image:
offer: "{{ image.offer }}"
publisher: "{{ image.publisher }}"
sku: "{{ image.sku }}"
version: "{{ image.version }}"
tags:
Node: "{{ tags.Node }}"
ssh_public_keys:
- path: "/home/{{ cloud_config.admin_username }}/.ssh/authorized_keys"
key_data: "{{ cloud_config.ssh.publickey }}"
data_disks:
- lun: 0
disk_size_gb: "{{ disks.disk_size }}"
caching: "{{ disks.caching }}"
managed_disk_type: "{{ disks.disk_type }}"
Other part to format and mount the disk
- name: partition new disk
shell: 'echo -e "n\np\n1\n\n\nw" | fdisk /dev/sdc'
args:
executable: /bin/bash
- name: Makes file system on block device
filesystem:
fstype: xfs
dev: /dev/sdc1
- name: new dir to mount
file: path=/hadoop state=directory
- name: mount the dir
mount:
path: /hadoop
src: /dev/sdc1
fstype: xfs
state: mounted
My question: device name cannot be configured. It can be /dev/sdc or /dev/sdb. For AWS ec2, I can set volumes[device_name], But I don't find such field in Azure. How could I fix it?