Share via

F5 vm launch using ansible_rm_deployment error

red-devil 61 Reputation points
2023-07-08T02:37:09.5666667+00:00

I am trying to launch F5 Azure vm using arm template inside ansible task using ansible_rm_deployment module .

I get the below error

tasks:
  - name: Deploy virtual machine
    azure_rm_deployment:
      state: present
      subscription_id: "{{ subscription }}"
      resource_group: "{{ resourceGroup }}"
      name: "{{ vmName }}"
      location: "{{ location }}"
      template: "{{ lookup('file', 'template.json') }}"
      parameters: "{{ (lookup('file', 'param.json') | from_json).parameters }}"

TASK [Deploy virtual machine] *******************************************************************************************************

fatal: [localhost]: FAILED! => {"changed": false, "msg": "Resource group create_or_update failed with status code: 409 and message: (InvalidResourceGroupLocation) Invalid resource group location 'southindia'. The Resource group already exists in location 'westindia'.\nCode: InvalidResourceGroupLocation\nMessage: Invalid resource group location 'southindia'. The Resource group already exists in location 'westindia'."}

Looks like its trying to create RG ...but why ?

Azure Virtual Machines
Azure Virtual Machines

An Azure service that is used to provision Windows and Linux virtual machines.

0 comments No comments

Answer accepted by question author

Sedat SALMAN 14,455 Reputation points MVP
2023-07-08T09:40:29.8433333+00:00

The error message suggests that you're trying to create or update a resource group in a location ('southindia') where a resource group of the same name already exists but in a different location ('westindia'). The azure_rm_deployment Ansible module is responsible for creating new resources as defined in the ARM template. However, if the resource (in this case, a resource group) already exists, it will attempt to update it instead. This is why it appears to be trying to "create" the resource group: it's actually attempting to update the resource group to match the state defined in the ARM template, but because the locations do not match, it is failing.

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.