lxc_cache_resolvers [u'nameserver1',u'nameserver2'] fixing

When running bootstrap-aio.sh twice with latest ansible runs OR when
providing your own resolvers from inside a unicode file, the
lxc_cache_resolvers will be generated as this:
lxc_cache_resolvers: [u'nameserver1',u'nameserver2']

This commit fixes this behaviour, and allow provided lxc_cache_resolvers
into CLI, from a file, or generated from hosts (when not set).

Change-Id: I6cb34e1a922d374ddccc37fd7bf0fd5ff9e14b88
Signed-off-by: Jean-Philippe Evrard <jean-philippe@evrard.me>
This commit is contained in:
Jean-Philippe Evrard 2016-05-27 12:00:32 +01:00
parent bac35f12f8
commit f7369d903e
2 changed files with 5 additions and 4 deletions

View File

@ -121,7 +121,7 @@
- generate_secrets
- name: Get the DNS servers in use on the host
shell: grep nameserver /etc/resolv.conf
command: grep nameserver /etc/resolv.conf
register: nameservers
when:
- lxc_cache_resolvers is not defined
@ -130,9 +130,9 @@
- name: Set lxc_cache_resolvers fact
set_fact:
lxc_cache_resolvers: "[\"{{ nameservers.stdout_lines | join('\",\"') }}\"]"
lxc_cache_resolvers: "{{ nameservers.stdout_lines }}"
when:
- nameservers is defined
- lxc_cache_resolvers is not defined
tags:
- set-fact-lxc_cache_resolvers

View File

@ -89,7 +89,8 @@ lxc_net_netmask: 255.255.255.0
lxc_net_dhcp_range: 10.255.255.2,10.255.255.253
## LXC Container Settings
lxc_cache_resolvers: {{ lxc_cache_resolvers }}
lxc_cache_resolvers:
{{ lxc_cache_resolvers | to_nice_yaml }}
## Security hardening
apply_security_hardening: true