解决ansible template模板文件字段多u(unicode)
ansible template 使用jinjia2模板时,传主机列表时候字段多了个u(unicode),导致集群文件时读取异常。
解决方法:
添加|to_yaml or |to_json
{{ groups['es_server'] | map('extract',hostvars,'ansible_ssh_host') | list | to_json }}
添加|to_yaml or |to_json
{{ groups['es_server'] | map('extract',hostvars,'ansible_ssh_host') | list | to_json }}