Dig deeper into Ansible and F5 integration
I tried to write a detailed comment earlier today, but it was flagged as spam for some reason. I'll try again and be more succinct.
unfortunately, I did not phrase my question well, but Payal your comment gave me something to think about. I'm trying to assign multiple irules to a single virtual server by using a var file. next, I want to modify multiple virtual servers to have multiple irules--again using a var file. it seems each time I use a list of items to assign multiple irules via Ansible, I get a list of exceptions thrown. however, if I manually assign multiple irules to a single VS if I don't use a var file. I can also statically assign two irules and then dynamically assign a third irule from a var file using a loop. When I change the irule variable to be a single member list, I get a runtime exception.
heres my varfile with a simple dictionary that works with a loop:
irule_data:
- {irule: irule3, vs: vs_test01}
here is the same varfile that works because it uses a list with one element (I have to change the task code to signify I want to use item '0' of the embedded list):
irule_data:
- {irule: [ 'irule3' ], vs: vs_test01}
here's the varfile that fails using the same loop (the dictionary contains a list with two elements): irule_data: - {irule: [ 'irule3', 'irule4' ], vs: vs_test01}
I have tried using with_subelements, with_nested, etc, but all of these do not build the irule list to mimic the following during execution:
irules:
- irule1
- irule2
- irule3
- irule4
instead I get two task runs that look like this:
irules:
- irule1
- irule2
- irule3
irules:
- irule1
- irule2
- irule4
my overall problem is that I cannot find a way to successfully build the list of irules that I want to apply to the VS using a var file because each type of loop I use causes the task to be run multiple times instead of just once.
I have learned a lot from this thread, and I appreciate the attention and support it receives.
Thanks