Open rnsc opened 4 years ago
@rnsc Glad you raised this question, we will investigate and check this feature. Thank you!
hello, i'm afraid we need this feature to feed a list into the probes with "with_items" option. If not, how can we use a list to create multiple load_balancing_rules ?
Thanks
hello, i'm afraid we need this feature to feed a list into the probes with "with_items" option. If not, how can we use a list to create multiple load_balancing_rules ?
Thanks
We are investigating this feature and will make improvements as soon as possible!
Is anyone looking into this issue? The other Azure Ansible modules I've used are additive and only upsert data if the key (e.g. name) is the same (for example the NSG rules)...
That said, the following playbook works around the issue by creating the list of loadbalancer rules first (via set_fact
+ loop
) and then feeds this into azure_rm_loadbalancer
. @hdiass I guess you found your own workaround, but for others:
---
- name: Load Balancer Example
hosts: localhost
vars:
clients:
- name: client1
number: 10
- name: client2
number: 20
- name: client3
number: 30
tasks:
# workaround dumb module behaviour
- set_fact:
load_balancing_rules: "{{ load_balancing_rules | default([]) + [load_balancing_rule] }}"
loop: "{{ clients }}"
loop_control:
label: "{{ item.name }} ({{ item.number }})"
vars:
load_balancing_rule:
name: "{{ item.name }}"
backend_port: "{{ 20000 + (item.number * 10) | int}}"
protocol: Tcp
frontend_port: "{{ 10000 + (item.number * 10) | int}}"
frontend_ip_configuration: "my-frontend-ip"
backend_address_pool : "my-backend-address-pool"
probe: my-health-probe
# disable_outbound_snat: true
- debug: var=load_balancing_rules
- name: Add Load Balancer rules
azure.azcollection.azure_rm_loadbalancer:
profile: prod
resource_group: load-balancer-rg
name: dummy-load-balancer
load_balancing_rules: "{{ load_balancing_rules }}"
SUMMARY
I want to update the "load balancing rules" of a basic Azure Load Balancer. In Ansible 2.8, that module was updated for idempotency and it can be used to updated an existing LB object. However, it doesn't append the new rules to existing rules in a LB, it just overwrites all the rules. I was expecting the module to just "append" rules to the current set.
ISSUE TYPE
COMPONENT NAME
azure_rm_loadbalancer
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
Running on localhost.
STEPS TO REPRODUCE
Create a basic load balancer on Azure with a Frontend config and BackendPool. Add a Load balancing rule manually with a health probe on port 80. Execute Ansible task to add a new rule.
EXPECTED RESULTS
I'm expecting just my rule to be added, unless I specifically say I want to purge everything.
ACTUAL RESULTS
The rules and probes that are not part of the current Ansible task are deleted.
This issue was created following the migration to azure collections. Original ticket: https://github.com/ansible/ansible/issues/58069