Yep, I'd expect that.

Set fact is not really intended to store list facts at this time -- or at
least wasn't written for them.

I think this should be filed as a feature request, or otherwise someone
should take a stab at making this module do a little bit more with complex
data types.



On Mon, Dec 16, 2013 at 3:52 PM, Ross Becker <[email protected]> wrote:

> So, I've found another hiccup with lists.  I'm trying to set a value
> through a python "split" call, and then access the individual pieces.  I've
> verified that set_fact does in fact, set a list, because I can use the
> result for with_items, and it correctly picks up the individual values, but
> syntax which works for accessing array elements for a list set as a var,
> does not work for accessing the array elements when set via set_fact and
> python split.  Here's a small playbook which demonstrates the issue:
>
>
> - hosts: configurator
>   user: root
>   gather_facts: False
>
>   vars:
>     some_list: [ "foo", "bar", "baz" ]
>     ldap_base_dn: "jrbhome.net"
>
>   tasks:
>     - name: splittest
>       set_fact: ldap_domain_split="{{ldap_base_dn.split(".")}}"
>
>     - name: retrievetest
>       debug: msg="Item access {{ some_list[0] }}"
>
>     - name: retrievetest
>       debug: msg="Domain part 1 {{ ldap_domain_split[0] }}"
>
>     - name: retrieveloop
>       debug: msg="Domain part  {{item}}"
>       with_items: ldap_domain_split
>
>
>
>
> The first debug statement works perfectly, shows 'foo' for the value.  The
> with_items loop works correctly, but the value which comes back from
> "retrievetest" is '['.  I think it's setting the fact to a string, and
> accessing characters of the string, rather than correctly picking up that
> this is an array.... but it's very odd that with_items works in that case.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Michael DeHaan <[email protected]>
CTO, AnsibleWorks, Inc.
http://www.ansibleworks.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to