Skip to content

Instantly share code, notes, and snippets.

@adamfeldman
Last active June 11, 2019 13:07
Show Gist options
  • Save adamfeldman/8948a76879ff6caed16941e0218a0ede to your computer and use it in GitHub Desktop.
Save adamfeldman/8948a76879ff6caed16941e0218a0ede to your computer and use it in GitHub Desktop.
Parameterized systemd service to support multiple `cloudflared tunnel`
# /lib/systemd/system/cloudflared@.service
[Unit]
Description=Cloudflare Tunnels (%I)
After=network.target
[Service]
Type=simple
User=cloudflared
ExecStart=/usr/local/bin/cloudflared tunnel --config /etc/cloudflared/%i.yml
Restart=on-failure
RestartSec=10
KillMode=process
[Install]
WantedBy=multi-user.target
# Enable and start the service
systemctl enable cloudflared@config-ha
systemctl start cloudflared@config-ha
# /etc/cloudflared/config-ha.yml
hostname: {homeassistant.MYDOMAIN.COM}
url: https://{INTERNAL_IP}:8123
no-tls-verify: true
logfile: /var/log/cloudflared-ha.log
origincert: /etc/cloudflared/cert.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment