[Unit]
Description=etcd
Documentation=https://github.com/coreos

[Service]
ExecStart=ETCD_UNSUPPORTED_ARCH=arm /usr/local/bin/etcd \
  --name {{ ansible_hostname }} \
  --cert-file=/etc/etcd/kubernetes.pem \
  --key-file=/etc/etcd/kubernetes-key.pem \
  --peer-cert-file=/etc/etcd/kubernetes.pem \
  --peer-key-file=/etc/etcd/kubernetes-key.pem \
  --trusted-ca-file=/etc/etcd/ca.pem \
  --peer-trusted-ca-file=/etc/etcd/ca.pem \
  --peer-client-cert-auth \
  --client-cert-auth \
  --initial-advertise-peer-urls https://{{ ansible_default_ipv4.address }}:2380 \
  --listen-peer-urls https://{{ ansible_default_ipv4.address }}:2380 \
  --listen-client-urls https://{{ ansible_default_ipv4.address }}:2379,https://127.0.0.1:2379 \
  --advertise-client-urls https://{{ ansible_default_ipv4.address }}:2379 \
  --initial-cluster-token etcd-cluster-0 \
  --initial-cluster {{ etcd_host1 }}=https://{{ etcd_host1_ip }}:2380,{{ etcd_host2 }}=https://{{ etcd_host2_ip }}:2380 \
  --initial-cluster-state new \
  --data-dir=/var/lib/etcd
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
