- name: collect iptables exception lines
set_fact:
exceptions: "{{ exceptions | union([ '-A INPUT -p tcp --source {{ item }} --dport 3306 -j ACCEPT' ,
'-A INPUT -p tcp --source {{ item }} --dport 4567 -j ACCEPT']) }}"
with_items: web_ips
When I run above playbook, i get err
fatal: [db_node1] => Failed to template {{ exceptions | union(['-A INPUT -p tcp --source {{ item }} --dport 3306 -j ACCEPT','-A INPUT -p tcp --source {{ item }} --dport 4567 -j ACCEPT') }}: an unexpected type error occurred. Error was coercing to Unicode: need string or buffer, list found
my ansible version is 1.9.3.
Thanks for the response Brian. I tried your solution but the same error sticks around
- set_fact:
zk_connection_: >
{%- set servers = [] %}
{%- for host in groups['zk_servers'] %}
{%- set _ = servers.append(hostvars[host]['ansible_' +iface]['ipv4']['address']) %}
{%- endfor %}
{{- servers -}}