mirror of
https://github.com/phfroidmont/self-hosting.git
synced 2025-12-25 05:36:59 +01:00
24 lines
693 B
Django/Jinja
24 lines
693 B
Django/Jinja
#jinja2: trim_blocks:False
|
|
{%- macro cluster_hosts() -%}
|
|
{%- for host in groups['k8s_etcd'] -%}
|
|
{{hostvars[host]['ansible_hostname']}}=https://{{hostvars[host]['ansible_' + etcd_interface].ipv4.address}}:{{etcd_peer_port}}{% if not loop.last %},{% endif %}
|
|
{%- endfor -%}
|
|
{%- endmacro -%}
|
|
|
|
{%- set x=etcd_settings.__setitem__('initial-cluster',cluster_hosts()) -%}
|
|
|
|
[Unit]
|
|
Description=etcd
|
|
Documentation=https://github.com/coreos
|
|
|
|
[Service]
|
|
ExecStart={{etcd_bin_dir}}/etcd \
|
|
{%- for setting in etcd_settings|sort %}
|
|
--{{setting}}="{{etcd_settings[setting]}}" {% if not loop.last %}\{% endif %}
|
|
{%- endfor %}
|
|
Restart=on-failure
|
|
RestartSec=5
|
|
Type=notify
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|