openstack-ansible-nspawn_co.../templates/container_config.nspawn.j2

39 lines
1.1 KiB
Django/Jinja

# {{ ansible_managed }}
[Exec]
Boot=on
{% if deployment_environment_variables is defined %}
{% for key, value in deployment_environment_variables.items() %}
Environment={{ key }}={{ value }}
{% endfor %}
{% endif %}
MachineID={{ systemd_escape.stdout | to_uuid }}
[Files]
{% for ro_bind in nspawn_read_only_host_bindmount %}
BindReadOnly={{ ro_bind.source }}:{{ ro_bind.dest }}
{% endfor %}
Bind=/openstack/backup/{{ inventory_hostname }}:/var/backup
Bind=/openstack/log/{{ inventory_hostname }}:/var/log
{% for bind in container_default_bind_mounts | union(container_bind_mounts | default([])) %}
Bind={{ bind.mount_path }}:/{{ bind.bind_dir_path }}
{% endfor %}
{% for bind in nspawn_shared_host_bindmount %}
Bind={{ bind }}:{{ bind }}
{% endfor %}
[Network]
{% set macvlans = [] %}
{% for key, value in nspawn_combined_networks.items() %}
{% if value.interface is defined %}
{% set macvlan = value.interface %}
{% else %}
{% set macvlan = 'mv-' + value.bridge.split('br-')[-1] %}
{% endif %}
{% set _ = macvlans.append(macvlan) %}
{% endfor %}
{% if macvlans | length > 0 %}
Private=yes
MACVLAN={{ macvlans | unique | join(' ') }}
{% endif %}