Last Updated: February 25, 2016
·
1.175K
· mpdehaan

Making tasks more concise

Actions can be written like this...

tasks:
    - name: "Write foo.conf file"
       action: template src=templates/foo.conf.j2 dest=/etc/foo.conf

But also shortened up like this:

tasks:
    - name: "Write foo.conf file"
       template: src=templates/foo.conf.j2 dest=/etc/foo.conf

And if you want, you can leave off the name too, but just using the module name.

tasks:
     - template: src=templates/foo.conf.j2 dest=/etc/foo.conf

Be as verbose or non-verbose as you want!