Skip to content

Instantly share code, notes, and snippets.

@arbabnazar
Forked from ernestas-poskus/ansible.yml
Created August 20, 2016 19:40
Show Gist options
  • Save arbabnazar/ea752ba4d9d5ed2702fc2955eef5c0a2 to your computer and use it in GitHub Desktop.
Save arbabnazar/ea752ba4d9d5ed2702fc2955eef5c0a2 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