artis3n / ansible-role-tailscale

Ansible role to install and configure a Tailscale node.
https://galaxy.ansible.com/artis3n/tailscale
MIT License
388 stars 65 forks source link

[FEAT] Allow for configuration of tailscaled service #214

Open nlamirault opened 2 years ago

nlamirault commented 2 years ago

Is your feature request related to a problem? Please describe. I would like to enable Prometheus metrics for the tailscaled server.

$ tailscaled --help
Usage of tailscaled:
  -bird-socket string
        path of the bird unix socket
  -cleanup
        clean up system state and exit
  -debug string
        listen address ([ip]:port) of optional debug server
  -outbound-http-proxy-listen string
        optional [ip]:port to run an outbound HTTP proxy (e.g. "localhost:8080")
  -port value
        UDP port to listen on for WireGuard and peer-to-peer traffic; 0 means automatically select (default 0)
  -socket string
        path of the service unix socket (default "/var/run/tailscale/tailscaled.sock")
  -socks5-server string
        optional [ip]:port to run a SOCK5 server (e.g. "localhost:1080")
  -state string
        absolute path of state file; use 'kube:<secret-name>' to use Kubernetes secrets or 'arn:aws:ssm:...' to store in AWS SSM; use 'mem:' to not store state and register as an emphemeral node. If empty and --statedir is provided, the default is <statedir>/tailscaled.state. Default: /home/pi/.local/share/tailscale/tailscaled.state
  -statedir string
        path to directory for storage of config state, TLS certs, temporary incoming Taildrop files, etc. If empty, it's derived from --state when possible.
  -tun string
        tunnel interface name; use "userspace-networking" (beta) to not use TUN (default "tailscale0")
  -verbose int
        log verbosity level; 0 is default, 1 or higher are increasingly verbose
  -version
        print version information and exit

Describe the solution you'd like A variable which can add arguments to the Tailscaled service.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

artis3n commented 2 years ago

I definitely see that allowing configuration of the tailscaled service in this role would be a great new feature. Can you elaborate how Prometheus metrics enters the mix?

McSim85 commented 10 months ago

I definitely see that allowing configuration of the tailscaled service in this role would be a great new feature. Can you elaborate how Prometheus metrics enters the mix?

I think, @nlamirault meant this parameter:

--debug=localhost:8080, to run a debug HTTP server serving paths such as /debug/pprof, /debug/metrics, /debug/ipn, /debug/magicsock, etc. The exact details of what’s accessible over the debug server is subject to change over time.

(c) https://tailscale.com/kb/1278/tailscaled/#flags-to-tailscaled

artis3n commented 10 months ago

Ah! That makes a lot of sense. It looks like we can run a lineinfile module against /etc/default/tailscaled looking for FLAGS= and include any flags an end user defines. Is that comma-separated, do you know?

McSim85 commented 10 months ago

Ah! That makes a lot of sense. It looks like we can run a lineinfile module against /etc/default/tailscaled looking for FLAGS= and include any flags an end user defines. Is that comma-separated, do you know?

Yep, it's the best way for Linux, I think. It seems like /etc/default/tailscaled works for both openrc and sytemd.

artis3n commented 10 months ago

My assumption is the FLAGS string is a space-delineated set of the -- flags marked in https://tailscale.com/kb/1278/tailscaled#flags-to-tailscaled. Will play with this in a few days and get a PR up