Unable to start azure vms with ansible

Achong 0 Reputation points
2023-03-23T15:08:04.2833333+00:00

Hi everyone,

I have 5 vms on azure. The ansible yml can start vm (z1, z2, z3) but when try to start b1 and b2 got error:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: KeyError: 'diskSizeGB'

failed: [localhost] (item=b1) => {"ansible_loop_var": "item", "changed": false, "item": "b1", "module_stderr": "Traceback (most recent call last):\n File "/home/achg/.ansible/tmp/ansible-tmp-1679583837.0334876-167289663996467/AnsiballZ_azure_rm_virtualmachine.py", line 102, in <module>\n _ansiballz_main()\n File "/home/achg/.ansible/tmp/ansible-tmp-1679583837.0334876-167289663996467/AnsiballZ_azure_rm_virtualmachine.py", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/home/achg/.ansible/tmp/ansible-tmp-1679583837.0334876-167289663996467/AnsiballZ_azure_rm_virtualmachine.py", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.cloud.azure.azure_rm_virtualmachine', init_globals=None, run_name='main', alter_sys=True)\n File "/usr/lib/python3.8/runpy.py", line 207, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code...

DETAILS: vms b1 and b2 has two more disks attached

- name: Start all  machines
  hosts: localhost

  vars:
    list_of_Servers: 
      - z1 
      - z2
      - z3
      - b1
      - b2
  tasks:
  - name: Start all machines task
    azure_rm_virtualmachine:
      resource_group: cluster-ansible
      name: "{{ item }}"
      started: true
      state: present
    loop: "{{ list_of_Servers }}"
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,081 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Manu Philip 16,961 Reputation points MVP
    2023-03-23T15:30:13.9233333+00:00

    Have you checked that the region in which you tries to turn on the virtual machine has enough diskSize quota available?

    Azure Portal > Select Desired Subscription > Usage + Quotas > Provider = diskSize

    User's image

    If the usage limit is reached, you have to 'Request a Quota Increase' from the same page


    --please don't forget to upvote and Accept as answer if the reply is helpful--

    0 comments No comments