Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azure_rm_virtualmachine enable_automatic_updates error when not specified #1332

Closed
mdicerbo opened this issue Nov 13, 2023 · 5 comments · Fixed by #1410
Closed

azure_rm_virtualmachine enable_automatic_updates error when not specified #1332

mdicerbo opened this issue Nov 13, 2023 · 5 comments · Fixed by #1410
Labels
has_pr PR fixes have been made medium_priority Medium priority question Further information is requested

Comments

@mdicerbo
Copy link

SUMMARY

when trying to change vm size of a windows vm with enableAutomaticUpdates set to false, resize fails with the following error (on Azure Portal)

Changing property 'windowsConfiguration.enableAutomaticUpdates' is not allowed.

property enable_automatic_updates is not specified on task

ISSUE TYPE
  • Bug Report
COMPONENT NAME

azure_rm_virtualmachine

ANSIBLE VERSION

ansible version 2.14.5


##### COLLECTION VERSION
azure.azcollection 1.19


##### OS / ENVIRONMENT
target OS windows server 2019


##### STEPS TO REPRODUCE
  tasks:
    - name: Change VM Size
      azure_rm_virtualmachine:
        resource_group: "{{ resource_group }}"
        name: "{{ vmname }}"
        started: true
        state: present
        allocated: true
        vm_size: "{{ size }}"
      register: changevmresult
      ##To force playbook fail enable lines 44 + 46 and disable lines 43 + 45
      ##12.05##failed_when: changevmresult.ansible_facts.azure_vm.powerstate != "running"
      failed_when: changevmresult.failed == "true"
      ##failed_when: changevmresult.ansible_facts.azure_vm.powerstate == "running"
      until: changevmresult.ansible_facts.azure_vm.powerstate == "running"
      ##until: changevmresult.ansible_facts.azure_vm.powerstate != "running"
      retries: 3
      delay: 5
      timeout: 1200

<!--- HINT: You can paste gist.github.com links for larger files -->

##### EXPECTED RESULTS
VM Change size without issues


##### ACTUAL RESULTS
The conditional check 'changevmresult.ansible_facts.azure_vm.powerstate == \"running\"' failed. The error was: error while evaluating conditional (changevmresult.ansible_facts.azure_vm.powerstate == \"running\"): 'dict object' has no attribute 'ansible_facts'. 'dict object' has no attribute 'ansible_facts'"
@maciejduk
Copy link

I am having the same issue with the following:

Code

  tasks:
    - name: "Gather info on VM and register into a variable"
      azure.azcollection.azure_rm_virtualmachine_info:
        resource_group: "{{ resource_group }}"
        name: "{{ vm_name }}"
      register: r_vm_info
      ignore_errors: true
    - name: "Apply tags to VM"
      azure.azcollection.azure_rm_virtualmachine:
        resource_group: "{{ resource_group }}"
        name: "{{ vm_name }}"
        started: "{% if r_vm_info.vms[0].power_state == 'running' %}true{% else %}false{% endif %}"
        append_tags: true
        tags:
          StartStop: "{{ StartStop }}"
          StartStop_ContactEmail: "{{ StartStop_ContactEmail }}"
          StartStop_ShutdownDays: "{{ StartStop_ShutdownDays }}"
          StartStop_StartupDays: "{{ StartStop_StartupDays }}"
          StartStop_TimeZone: "{{ StartStop_TimeZone }}"
          StartStop_ShutdownTime: "{{ StartStop_ShutdownTime }}"
          StartStop_StartupTime: "{{ StartStop_StartupTime }}"
          StartStop_SystemShutdown: "true"

Execution result

TASK [Gather info on VM and register into a variable] **************************
ok: [localhost]

TASK [Apply tags to VM] ********************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Error creating or updating virtual machine XXXXXXXX - (PropertyChangeNotAllowed) Changing property 'windowsConfiguration.enableAutomaticUpdates' is not allowed.\\nCode: PropertyChangeNotAllowed\\nMessage: Changing property 'windowsConfiguration.enableAutomaticUpdates' is not allowed.\\nTarget: windowsConfiguration.enableAutomaticUpdates"}

System Info

# /usr/share/ansible/collections/ansible_collections
Collection         Version
------------------ -------
ansible.windows    2.1.0  
azure.azcollection 1.18.1 
community.windows  2.0.0  
bash-4.4# ansible --version
/usr/local/lib/python3.8/site-packages/paramiko/transport.py:236: CryptographyDeprecationWarning: Blowfish has been deprecated
  "class": algorithms.Blowfish,
ansible [core 2.12.5.post0]
  config file = None
  configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
  ansible collection location = /home/runner/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.8.12 (default, Sep 21 2021, 00:10:52) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
  jinja version = 2.10.3
  libyaml = True

@Fred-sun
Copy link
Collaborator

@mdicerbo The 'enable_automatic_updates' attribute is not allowed to be updated. Is this attribute in your configuration different from the one you created earlier? Thank you!

@Fred-sun
Copy link
Collaborator

@mdicerbo I've tested this parameter locally, and whether the parameter is True or False, I can 'started', 'allocated' or add tags. Thank you!

@Fred-sun Fred-sun added question Further information is requested medium_priority Medium priority work in In trying to solve, or in working with contributors labels Nov 23, 2023
@Fred-sun Fred-sun added has_pr PR fixes have been made and removed work in In trying to solve, or in working with contributors labels Jan 17, 2024
@Fred-sun
Copy link
Collaborator

fixed by #1410

@mdicerbo
Copy link
Author

mdicerbo commented Jan 17, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has_pr PR fixes have been made medium_priority Medium priority question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants