some blog : )

varnishadm-ninja

Posted at — May 11, 2020

Simple and elegant tool to communicate with Varnish over CLI


Features

Basic installation

No Varnish packages required to be installed on control host - it means tool could be used even you have no permissions to install Varnish repository and packages to obtain official varnishadm utility.

Just grab binary from GitHub Releases page and set executable bit or build it from sources (if you’re paranoid):

go get -u github.com/akuznecov/varnishadm-ninja
Flexibility

No need to have an access to file with secret key (typically, /etc/varnish/secret). But still need to know it for authentication (see Usage).

Run from anywhere (only thing you need - network access to Varnish CLI terminal):

Compatibility

Almost of all varnishadm commands could used with varnishadm-ninja.


Usage

Syntax
$ varnishadm-ninja -T ADDRESS:PORT -S SECRET <command> [<arguments> <flags>]

where:

Example

Invalidate cache for specific combination of domain and URL:

varnishadm-ninja -T lb01.foobar.intranet:35964 -S bd88ecbc-513c-494a-ab39-a8ca539de515 ban 'req.http.host == "www.example.com" && req.url ~ "^/funny/kittens/"'