"Simple" set_fact issue

9 views
Skip to first unread message

Moshe Suberri

unread,
Apr 21, 2016, 11:10:18 PM4/21/16
to Ansible Project
  
I am trying to create a list from a set of variables and have some problem doing that.

I must admit I do not understand why it is not easy to manipulate list/dict/vars in Ansible. I must be missing somthing.

So here is my issue:


-set_fact:
     my_list: ["abc"]      # ok
     index: 0                  # ok
    
- debug: var=my_list[{{index}}]           #ok
- debug: var=public_subnets[0]         #ok

-set_fact: 
    abcd: "{{ my_list[index] }}"                   #ok
    my_list["{{index}}"]: "abcdefg"             # does not work
    my_list[0]: "abcdefg"                          # does not work
    my_list.append( "abcdefg")                #  does not wokr


is there a way to assign a value to  my_list ins the index location or to append to the end of the list

 

Reply all
Reply to author
Forward
0 new messages