On 25 August 2014 15:49, Jeff Geerling <[email protected]> wrote:
> In the documentation, and for terseness, many task examples are given like:
>
> - apt: pkg=package_name state=installed update_cache=yes
>
> However, for version control, legibility, etc., it's usually preferred (at
> least as far as I've seen) to use a parameter-per-line approach, and there
> are two basic ways to do this with normal YAML syntax, first, with the YAML
> escape character and the parameters formatted the same (key=value):
>
> - apt: >
> pkg=package_name
> state=installed
> update_cache=yes
>
> And second, using a normal YAML collection:
>
> - apt:
> pkg: package_name
> state: installed
> update_cache: yes
>
> To my eye, both are valid approaches—with the edge towards normal YAML
> collections, since syntax highlighting will allow for the keys to be
> highlighted as such, and values will be in the normal string/bool/constant
> mode. So visually, I lean towards the second option.
>
>
To throw in a third option, this is often what I do:
- name: ensure .ssh directory present
file: path={{ home_dir }}/.ssh state=directory mode=0700
owner={{ file_owner }} group={{ file_owner }}
No ">" is needed if you indent like this. I like to hard wrap at 80 chars
for easier diff reading but one line per param is a bit overkill for my
taste.
--
Tom Bamford
*@Planet*
ATPLANET (Pty) Ltd
atplanet.co.za
Cell: +27 (0)79-095-7112
Fax: +27 (0)86-599-1310
--
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/CAAnNz0Mg%2BN0heyn4xLwXG05Dbs4tnQyi--%2B62v3fsDrUgaq97g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.