mirror of
https://github.com/phfroidmont/self-hosting.git
synced 2025-12-25 13:46:59 +01:00
25 lines
693 B
Text
25 lines
693 B
Text
|
|
#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
|