Hi Brian,

On 10-09-14 23:14, Brian Coca wrote:
short description, list (or array)  is as it sounds, simple list of
items, a dict or a hash is a list that uses an 'name' to locate the
item

Got it.

1, 2, 3 < = simiple list, in python/yaml/json (stuff ansible uses) it
is normally in brackets mylist= [1,2,3], lists can be referenced by a
number that describes the position (normally starting by 0)  mylist[1]
would return 2

Ok.

a dict, hash or associative array is a special list that uses names,
normally represented with {}
mydict = { 'one': 1, 'two': 2, 'three', 3}, to access an item you use
the names: mydict['two'] returns 2.

Ok.

in yaml starting with a '-' normally indicates a list item
mylist:
   - 1
   - 2
   - 3

Ok.

for dicts just ignore the - and add the name
mydict:
   one: 1
   two: 2
   three: 3

Ok.

That wasn't too bad :) Small addition. In my first few hours with Ansible I needed this one for file copying from src to dst:

mydict:
  - src: file1.txt
    dst: /some/where/file_1.txt

Thank you for your explanation. That was most helpful. For the archives, the Ansible examples on github also provide a ton of enlightening info on how to do things:

https://github.com/ansible/ansible-examples/tree/master/language_features

Cheers,
Patrick

--
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/54123883.3090107%40puzzled.xs4all.nl.
For more options, visit https://groups.google.com/d/optout.

Reply via email to