Task YML Synthax

22 views
Skip to first unread message

Yoann DAVID

unread,
Oct 7, 2014, 9:23:27 AM10/7/14
to ansible...@googlegroups.com
Hello,

depending of the playbook, the modules attribute's in task are differently written :

Colon synthax :

- name: APT | Update the general configuration (/etc/apt/apt.conf.ds/10general)
    template:
       src: etc_apt_apt.conf.d_10general.j2
      dest: /etc/apt/apt.conf.d/10general
      owner: root
      group: root
      mode: 0644


Equal synthax :

- name: Configure APT and package sources
    template:
    src={{ item }}.j2
    dest=/{{ item }}
    owner=root
    group=root
    mode=0644
    with_items:
       - 'etc/apt/sources.list'


Why ?
Which one is prefered ?
Must one of this will be deprecated ?


Thanks a lot



Michael DeHaan

unread,
Oct 8, 2014, 8:45:08 AM10/8/14
to ansible...@googlegroups.com
The "=" short form is often more concise for simple things that can be put all on one line

   - copy: src=a dest=/tmp/b mode=0644 owner=root

etc

Both are fine and neither will be deprecated.

The colon form is needed to pass structured data, as is required by some modules, like the ec2 modules



--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/21754e3e-b05e-4181-8eee-6599baca35a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Yoann DAVID

unread,
Oct 8, 2014, 8:54:44 AM10/8/14
to ansible...@googlegroups.com
Thanks a lot for your answer.

Le 08/10/14 14:45, Michael DeHaan a écrit :
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/6knezkHUpqU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.

To post to this group, send email to ansible...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages