Joined February 2013
·

Michael DeHaan

NC, USA
·
·
·

Also the second form will result in one big list.

This is because you usually want:

- yum: name={{ item }} state=installed
  with_items:
     - alist
     - blist

As such, use the hash form if you want to pass multiple things, the item.0 and item.1 approach is not going to work as above.

This looks like is misformatted in Coderwall.

You can fix this by indenting each line with 4 spaces.

Trivally speaking, this is the way to list group names for the active host:

{% for group in group_names %}
    {{ group }}
{% endfor %}

Also this part:

if hostvars[host]["ansible_default_ipv4"]["address"] == ansible_ssh_host

Looks a little strange.

If you just want to join a list, there's also no need for the count:

{{ ",".join(listvar) }}

Also new in 1.1, "ansible-playbook playbook.yml --step" can let you interactively step through playbooks and decide what to run.

@elee think maybe you wanted to start a new tip versus commenting on this one maybe.

Latest released is 1.0 and 1.1 is the current development branch, which doesn't present an error if that file is missing.

Posted to Specify a base directory over 1 year ago

Might want to use a local play and register it instead, just as that will execute a few too many times if used a lot... we need to get the "PIPE_ONCE" part going.

Posted to Remove that scary bovine over 1 year ago

Very useful for boss-mode demonstrations when ordinarily you like the cow!

I should indicate that there is nothing simulated about this, it's quite real. If you're not running the command, you're not running the command :)

Posted to Dump hostvars over 1 year ago

It's totally useful to know how to iterate over them, though here are some other neat tricks:

{{ hostvars | to_json }}

{{ hostvars | to yaml }}
Achievements
845 Karma
91,029 Total ProTip Views