[Unit]
Description=Add etcd2 node to existing cluster
Conflicts=etcd2.service etcd2-backup.service
Before=etcd2.service etcd2-backup.service

[Service]
Type=oneshot
ExecStartPre=/usr/bin/rm -rf ${ETCD_DATA_DIR}/member
ExecStartPre=/usr/bin/chown -R etcd:etcd ${ETCD_DATA_DIR}
ExecStart=/opt/bin/etcd2-join ${ETCD_RESTORE_MASTER_ADV_PEER_URLS} ${ETCD_NAME} ${ETCD_INITIAL_ADVERTISE_PEER_URLS}

[Install]
WantedBy=multi-user.target
