I'm working on setting up some automation for an F5 BigIP load balancer. When creating the virtual server, I have a variable containing the various profiles I want to include and also a few that should always be included.
I want to use this variable:
domains:
- foo.example.com
- bar.example.com
- baz.example.com
In the following module under profiles. Note, I can't do a loop because that would replace the value each time. I want all list items from domains to be expanded in the single execution of this task. I've tried using a Jinja for loop but it just hangs when I try to execute.
- name: Configure virtual server
f5networks.f5_modules.bigip_virtual_server:
state: present
partition: Common
name: insite-ssl
destination: 10.10.10.10
port: 443
pool: example-pool
snat: Automap
description: Testing VIP
profiles: |
{% for domain in domains %}
- name: {{ domain }}
context: client-side
{% endfor %}
- http-SSL-XForwarded
- name: example.com_wildcard
context: client-side
provider: "{{ f5_conn }}"
tags:
- vip
What is the right way to solve this?