# new-style variables and complex args

**URL:** <https://forum.ansible.com/t/new-style-variables-and-complex-args/12758>\
**Category:** Ansible Project\
**Created:** [May 2, 2013, 4:40pm UTC](https://forum.ansible.com/t/new-style-variables-and-complex-args/12758 "2013-05-02T16:40:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![C\_Morgan\_Hamill](https://avatars.discourse-cdn.com/v4/letter/c/ebca7d/32.png) [@C\_Morgan\_Hamill](https://forum.ansible.com/u/C_Morgan_Hamill)\
**Post date:** [May 2, 2013, 4:40pm UTC](https://forum.ansible.com/t/new-style-variables-and-complex-args/12758/1 "2013-05-02T16:40:55Z")

</div>

It seems the following thingies don't behave identically:

These:

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [May 2, 2013, 4:46pm UTC](https://forum.ansible.com/t/new-style-variables-and-complex-args/12758/2 "2013-05-02T16:46:58Z")

</div>

Can you show me this in a real-world use case? I can’t imagine “heyo, huzzah” in array forms is that important.

---

<div class="post-metadata">

**Author:** ![C\_Morgan\_Hamill](https://avatars.discourse-cdn.com/v4/letter/c/ebca7d/32.png) [@C\_Morgan\_Hamill](https://forum.ansible.com/u/C_Morgan_Hamill)\
**Post date:** [May 2, 2013, 5:06pm UTC](https://forum.ansible.com/t/new-style-variables-and-complex-args/12758/3 "2013-05-02T17:06:11Z")

</div>

Excerpts from Michael DeHaan's message of 2013-05-02 12:46:58 -0400:

> Can you show me this in a real-world use case? I can't imagine "heyo,  
> huzzah" in array forms is that important.

Haha, fair.

So in my shop we've got a pair of F5 LTMs, so I was working on a module  
for pulling nodes out of pools, putting them back in, etc.

Because there's a pair of machines, I wanted to pass the module a list  
of hosts so that it could find out which one is currently active before  
running commands.

So I've got:

---

<div class="post-metadata">

**Author:** ![Serge\_van\_Ginderacht](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Serge\_van\_Ginderacht](https://forum.ansible.com/u/Serge_van_Ginderacht)\
**Post date:** [May 2, 2013, 5:30pm UTC](https://forum.ansible.com/t/new-style-variables-and-complex-args/12758/4 "2013-05-02T17:30:46Z")

</div>

​​Hi Morgan,

---

<div class="post-metadata">

**Author:** ![C\_Morgan\_Hamill](https://avatars.discourse-cdn.com/v4/letter/c/ebca7d/32.png) [@C\_Morgan\_Hamill](https://forum.ansible.com/u/C_Morgan_Hamill)\
**Post date:** [May 2, 2013, 5:45pm UTC](https://forum.ansible.com/t/new-style-variables-and-complex-args/12758/5 "2013-05-02T17:45:40Z")

</div>

Excerpts from Serge van Ginderachter's message of 2013-05-02 13:30:46 -0400:

> As we are using Bip-IP F5's ourselves, I'd be very interested to work with  
> you on this module.  
> Did you publish it yet?

No, I only started working on it today.

When I get the bare bones of it built, I'll put it on github and send  
you a note.

Any use cases in particular you're thinking of, or ideas for what kind  
of arguments the module ought to take?

---

<div class="post-metadata">

**Author:** ![Serge\_van\_Ginderacht](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Serge\_van\_Ginderacht](https://forum.ansible.com/u/Serge_van_Ginderacht)\
**Post date:** [May 2, 2013, 6:02pm UTC](https://forum.ansible.com/t/new-style-variables-and-complex-args/12758/6 "2013-05-02T18:02:30Z")

</div>

> When I get the bare bones of it built, I'll put it on github and send  
> you a note.

Great!  
​​

> Any use cases in particular you're thinking of, or ideas for what kind  
> of arguments the module ought to take?

Not immediately, as i didn't plan to start wokring on such a module, I  
didn't thought it through yet. We do have quite some strict standards to  
adhere to, so my use cases could be a bit special. We do tend to have a  
very strict naming policy.

The basic things ​​we do for every node (actually node pair, as  
\*everything$ in our environment had a node -1 and -2):

- create the nodes  
- create a monitor  
- create the pool enabled with that monitor  
- create 2 basic virtual servers  
- create a virtual server from another service, to be available to this new  
set of servers (every pair of nodes lives in its own non routed vlan)

Most variable things when creating a VS, are, for us:  
- name  
- destination ip and port  
- pool  
- source nat vlan  
- destination vlan

The rest are often defaults. It might be interesting to define some  
templates

How to create virtual servers should be possible with some kind of  
template, or default set of parameters.

I look forward to have a look at your first version!

&nbsp;&nbsp;Serge

PS: unrelated, but if you allow me to make a shameless plug: I recently  
started this project:  
&nbsp;&nbsp;[https://github.com/ansible-contrib/ansible-plugins](https://github.com/ansible-contrib/ansible-plugins)  
and try to group various ansible plugins which didn't made it (yet) in core.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [May 2, 2013, 7:03pm UTC](https://forum.ansible.com/t/new-style-variables-and-complex-args/12758/7 "2013-05-02T19:03:32Z")

</div>

So in action lines it doesn’t make sense to request an array anyway.

{{ “,”.join(foo) }}

In the other form, since templates effectively _ARE_ about strings, I don’t think you can really expect refering variables inside variable definitions where they are data structures to magically know what you want them to do.
