Ansible Azure - Error CanceledAndSupersededDueToAnotherOperation

Viewed 36

One of my playbook is executed by multiple instances and if ansible should ignore if the rule or group already exists. But I'm getting this error instead. Any idea why I get this error and how I can prevent it?

Error creating/updating security group testing_cloudshell_sg_201 - Azure Error: Canceled\nMessage: Operation was canceled.\nException Details:\n\tError Code: CanceledAndSupersededDueToAnotherOperation

Operation PutNetworkSecurityGroupOperation (ce212e6d-2196-4e0f-9d52-9433535be288) was canceled and superseded by operation PutNetworkSecurityGroupOperation (2c9b8db1-30f3-4486-965e-3449b4572858)

Here is a sample of playbook which gets executed by multiple instances.

  - name: create Azure security group
    # create a security group for the vpc
    azure_rm_securitygroup:
      resource_group: "{{ resource_group }}"
      location: "{{ azure_vm_region }}"
      purge_rules: no
      name: "{{ sg_name }}"
      rules: >-
        {{
          sg_rules.splitlines()
          | map('split', ',')
          | json_query("[*].{
            name: [0],
            protocol: [1],
            source_port_range: [2],
            destination_port_range: [3],
            source_address_prefix: [4],
            destination_address_prefix: [5],
            priority: [6],
            access: 'Allow',
            direction: 'Inbound'
          }")
        }}
      tags:
        Name: "{{ sg_name }}"
    register: azure_security_group_results

  - name: Update Azure security group with static Rule
    azure_rm_securitygroup:
      resource_group: "{{ resource_group }}"
      location: "{{ azure_vm_region }}"
      purge_rules: no
      name: "{{ sg_name }}"
      rules:
          - name: AWX-SSH
            protocol: Tcp
            source_port_range: "*"
            destination_port_range: 22
            source_address_prefix: "{{ sg_ssh_cidr }}"
            destination_address_prefix: "*"
            priority: 299
            access: "Allow"
            direction: "Inbound"
    register: azure_security_group_results_2
0 Answers
Related