{"id":13655003,"url":"https://github.com/geerlingguy/ansible-role-varnish","last_synced_at":"2026-03-14T17:42:20.516Z","repository":{"id":15676576,"uuid":"18414072","full_name":"geerlingguy/ansible-role-varnish","owner":"geerlingguy","description":"Ansible Role - Varnish HTTP accelerator","archived":false,"fork":false,"pushed_at":"2025-01-31T03:25:54.000Z","size":136,"stargazers_count":82,"open_issues_count":3,"forks_count":89,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-28T12:08:30.356Z","etag":null,"topics":["ansible","http-accelerator","load-balancer","proxy","reverse-proxy","role","varnish"],"latest_commit_sha":null,"homepage":"https://galaxy.ansible.com/geerlingguy/varnish/","language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/geerlingguy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"geerlingguy","patreon":"geerlingguy"}},"created_at":"2014-04-03T18:44:30.000Z","updated_at":"2025-01-31T03:25:57.000Z","dependencies_parsed_at":"2024-01-14T16:10:57.466Z","dependency_job_id":"f99a0421-45a8-4a15-a453-e85915624275","html_url":"https://github.com/geerlingguy/ansible-role-varnish","commit_stats":null,"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2Fansible-role-varnish","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2Fansible-role-varnish/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2Fansible-role-varnish/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2Fansible-role-varnish/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geerlingguy","download_url":"https://codeload.github.com/geerlingguy/ansible-role-varnish/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247182378,"owners_count":20897380,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","http-accelerator","load-balancer","proxy","reverse-proxy","role","varnish"],"created_at":"2024-08-02T03:00:54.641Z","updated_at":"2026-03-14T17:42:20.509Z","avatar_url":"https://github.com/geerlingguy.png","language":"Jinja","funding_links":["https://github.com/sponsors/geerlingguy","https://patreon.com/geerlingguy"],"categories":["Jinja","role","Reverse Proxy"],"sub_categories":["Webservers"],"readme":"# Ansible Role: Varnish\n\n[![CI](https://github.com/geerlingguy/ansible-role-varnish/actions/workflows/ci.yml/badge.svg)](https://github.com/geerlingguy/ansible-role-varnish/actions/workflows/ci.yml)\n\nInstalls the [Varnish HTTP Cache](https://varnish-cache.org/) on RedHat/CentOS or Debian/Ubuntu Linux.\n\n## Requirements\n\nRequires the EPEL repository on RedHat/CentOS (you can install it using the `geerlingguy.repo-epel` role).\n\n## Role Variables\n\nAvailable variables are listed below, along with default values (see `defaults/main.yml`):\n\n    varnish_package_name: \"varnish\"\n\nVarnish package name you want to install. See `apt-cache policy varnish` or `yum list varnish` for a listing of available candidates.\n\n    varnish_version: \"6.6\"\n\nVarnish version that should be installed. See the [Varnish Cache packagecloud.io repositories](https://packagecloud.io/varnishcache) for a listing of available versions. Some examples include: `6.6`, `6.5`, `6.4`, `4.1`, `3.0`, and `2.1`.\n\n    varnish_config_path: /etc/varnish\n\nThe path in which Varnish configuration files will be stored.\n\n    varnish_use_default_vcl: true\n\nWhether to use the included (simplistic) default Varnish VCL, using the backend host/port defined with the next two variables. Set this to `false` and copy your own `default.vcl` file into the `varnish_config_path` if you'd like to use a more complicated setup. If this variable is set to `true`, all other configuration will be taken from Varnish's own [default VCL](https://www.varnish-cache.org/trac/browser/bin/varnishd/default.vcl?rev=3.0).\n\n    varnish_default_vcl_template_path: default.vcl.j2\n\nThe default VCL file to be copied (if `varnish_use_default_vcl` is `true`). Defaults the the simple template inside `templates/default.vcl.j2`. This path should be relative to the directory from which you run your playbook.\n\n    varnish_listen_address: \"\"\n    varnish_listen_port: \"80\"\n\nThe address and port on which Varnish will listen. The defaults tell Varnish to listen on all interfaces on port 80, but you can specify an address and/or alternate port if desired.\n\n    varnish_default_backend_host: \"127.0.0.1\"\n    varnish_default_backend_port: \"8080\"\n\nSome settings for the default \"default.vcl\" template that will be copied to the `varnish_config_path` folder. The default backend host/port could be Apache or Nginx (or some other HTTP server) running on the same host or some other host (in which case, you might use port 80 instead).\n\n    varnish_limit_nofile: 131072\n\nThe `nofiles` PAM limit Varnish will attempt to set for open files. The normal default is 1024 which is much too low for Varnish usage.\n\n    varnish_secret: \"14bac2e6-1e34-4770-8078-974373b76c90\"\n\nThe secret/key to be used for connecting to Varnish's admin backend (for purge requests, etc.).\n\n    varnish_admin_listen_host: \"127.0.0.1\"\n    varnish_admin_listen_port: \"6082\"\n\nThe host and port through which Varnish will accept admin requests (like purge and status requests).\n\n    varnish_storage: \"file,/var/lib/varnish/varnish_storage.bin,256M\"\n\nHow Varnish stores cache entries (this is passed in as the argument for `-s`). If you want to use in-memory storage, change to something like `malloc,256M`. Please read Varnish's [Getting Started guide](http://book.varnish-software.com/4.0/chapters/Getting_Started.html) for more information.\n\n    varnish_pidfile: /run/varnishd.pid\n\nVarnish PID file path. Set to an empty string if you don't want to use a PID file.\n\n    varnishd_extra_options: \"\"\n\nExtra options or flags to pass to the Varnish daemon when it starts (e.g. `-p http_max_hdr=128`).\n\n    varnish_enabled_services:\n      - varnish\n\nServices that will be started at boot and should be running after this role is complete. You might need to add additional services if required, e.g. `varnishncsa` and `varnishlog`. If set to an empty array, no services will be enabled at startup.\n\n    varnish_packagecloud_repo_yum_repository_priority: \"1\"\n\n(RedHat/CentOS only) The `yum` priority for the Packagecloud repository used to install Varnish. Setting this explicitly forces yum to use the Packagecloud repositories to install Varnish even in environments (e.g. Amazon Linux) where other repositories may have higher priorities than the default.\n\n    varnish_apt_repo: deb https://packagecloud.io/varnishcache/{{ varnish_packagecloud_repo }}/{{ ansible_facts.distribution | lower }}/ {{ ansible_facts.distribution_release }} main\n\n(Debian/Ubuntu only) The `repo` for the apt repository.\n\n    varnish_yum_repo_baseurl: https://packagecloud.io/varnishcache/{{ varnish_packagecloud_repo }}/el/{{ ansible_facts.distribution_major_version|int }}/$basearch\n\n(RedHat/CentOS only) The `baseurl` for the yum repository.\n\n    varnish_backends:\n      apache:\n        host: 10.0.2.2\n        port: 80\n      nodejs:\n        host: 10.0.2.3\n        port: 80\n    \n    varnish_vhosts:\n      example.com:\n        backend: apache\n      nodejs.example.com:\n        backend: nodejs\n\nYou can configure multiple backends (and direct traffic from multiple virtual hosts to different backends) using the `varnish_backends` and `varnish_vhosts` variables. If you only use one backend (defined via `varnish_default_backend_host` and `varnish_default_backend_port`), then you do not need to define these variables. Do not add a `www` to the `vhosts` keys; it is added automatically by the `default.vcl.j2` VCL template.\n\n## Dependencies\n\nNone.\n\n## Example Playbook\n\n    - hosts: webservers\n      vars_files:\n        - vars/main.yml\n      roles:\n        - geerlingguy.varnish\n\n*Inside `vars/main.yml`*:\n\n    varnish_secret: \"[secret generated by uuidgen]\"\n    varnish_default_backend_port: 81\n    ... etc ...\n\n## License\n\nMIT / BSD\n\n## Author Information\n\nThis role was created in 2014 by [Jeff Geerling](https://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeerlingguy%2Fansible-role-varnish","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeerlingguy%2Fansible-role-varnish","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeerlingguy%2Fansible-role-varnish/lists"}