我可以分开做,但不能将它们组合在一起,因为我不知道磁盘设备名称。
我的配置:
- 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 }}"
格式化和挂载磁盘的其他部分
- 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
我的问题:无法配置设备名称。它可以是 /dev/sdc 或 /dev/sdb。对于 AWS ec2,我可以设置volumes[device_name],但是我在 Azure 中没有找到这样的字段。我该如何解决?