Skip to content

Instantly share code, notes, and snippets.

@barlog-m
Last active July 17, 2019 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barlog-m/808999bec8f340608ba4b68744534e92 to your computer and use it in GitHub Desktop.
Save barlog-m/808999bec8f340608ba4b68744534e92 to your computer and use it in GitHub Desktop.
---
- name: append value to each string in a list
hosts: all
tasks:
- name: db
debug:
msg: "{{ groups['db'] | map('extract', hostvars, 'ansible_host') | zip_longest([], fillvalue='5432') | map('join', ':') | join(',') }}"
with_items: "{{ groups['db'] }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment