Skip to content

Instantly share code, notes, and snippets.

@ernestas-poskus
Last active August 20, 2016 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ernestas-poskus/8afc663df1848074c1f108c66dd6cd20 to your computer and use it in GitHub Desktop.
Save ernestas-poskus/8afc663df1848074c1f108c66dd6cd20 to your computer and use it in GitHub Desktop.
Ansible Tips
# Extracting all ips from defined group
ips: "{{ groups['webservers']|map('extract', hostvars, ['ansible_eth1', 'ipv4', 'address'])|list }}"
# Iterate through dict, reject empty values
nsq_nsqd_opts: "{% for key, value in nsq_nsqd.iteritems() if value is not none %}-{{ key | replace('_', '-') }}=\"{{ value }}\" {% endfor %}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment