Skip to content

Instantly share code, notes, and snippets.

@killua-eu
Created June 24, 2018 14:43
Show Gist options
  • Save killua-eu/f81af4a84e9cc1394d028a9b193380e7 to your computer and use it in GitHub Desktop.
Save killua-eu/f81af4a84e9cc1394d028a9b193380e7 to your computer and use it in GitHub Desktop.
---
- set_fact:
args:
c_name: "{{ outer_item.name }}"
tmp_proxy: "{{ outer_item.proxy | default([]) }}"
tmp_devices: "{{ outer_item.devices | default([]) }}"
- name: Populate proxy_devices
set_fact:
proxy_devices: "{{ proxy_devices|default({}) | combine( {item.name: { 'listen': item.proto + ':192.168.88.102:' + item.dst|string, 'connect': item.proto + ':127.0.0.1:' + item.nxt|string, 'bind': 'host', 'type': 'proxy' } }, recursive=True ) }}"
with_items: "{{ tmp_proxy }}"
- name: Merge
set_fact:
devices: "{{ tmp_devices | combine (proxy_devices) }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment