mirror of
https://github.com/phfroidmont/self-hosting.git
synced 2025-12-25 13:46:59 +01:00
Custom etcd role
This commit is contained in:
parent
958fb6be2f
commit
75a4c037da
11 changed files with 1038 additions and 5 deletions
24
roles/etcd/templates/etc/systemd/system/etcd.service.j2
Normal file
24
roles/etcd/templates/etc/systemd/system/etcd.service.j2
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#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
|
||||
Loading…
Add table
Add a link
Reference in a new issue