Allow user to override UseRoutes in template

You could perhaps have a group_vars/designate_all.yml looking like
this;

---
lxc_container_networks:
  lxcbr0_address:
    ...
    dhcp_use_routes: false

Change-Id: Id61fdb5a3b52a01a49242fc01cc01bf2dede09af
This commit is contained in:
Erik Berg 2020-10-05 16:47:56 +02:00
parent 2c463783aa
commit fd62da8df0
1 changed files with 3 additions and 2 deletions

View File

@ -10,8 +10,9 @@ Address={{ item.value.address }}/{{ addr_cidr }}
UseDNS={{ (lxc_container_enable_resolved | bool) | ternary('yes', 'no') }}
UseNTP=yes
RouteMetric=20
{% if hostvars[inventory_hostname]['gateway'] is defined %}
UseRoutes=False
{% if hostvars[inventory_hostname]['gateway'] is defined
or item.value.dhcp_use_routes is defined %}
UseRoutes={{ item.value.dhcp_use_routes | default(false) | bool | lower }}
{% endif %}
{% endif %}