Skip to content

bilalcaliskan/varnish-ansible-role

Repository files navigation

Varnish Ansible Role

CI GitHub tag

Installs and configures Varnish cache server on RHEL/CentOS 7/8 instances.

Requirements

This role has below requirements:

You can install suggested version with pip3:

$ pip3 install "ansible==2.9.16"

Note that this role requires root access, so either run it in a playbook with a global become: true, or invoke the role in your playbook.

Role Variables

See the default values in defaults/main.yml. You can overwrite them in vars/main.yml if neccessary or you can set them while running playbook.

Please note that this role can ensure that firewalld systemd service on your servers are started and enabled by default. If you want to start and enable firewalld service, please modify below variable as true while running playbook:

firewalld_enabled: true

Dependencies

None

Examples

Inventory

[varnish]
node01.example.com
node02.example.com
node03.example.com

Installation

- hosts: varnish
  become: true
  roles:
    - role: bilalcaliskan.varnish
      vars:
        varnish_install: true
        purging_enabled: true
        banning_enabled: true
        version: 60lts
        port: 6081
        limit_memlock: 85983232
        limit_core: infinity
        limit_nofile: 131072
        storage_backend: malloc
        storage_backend_size: 256m
        global_ttl: 5m
        global_grace: 30m
        backends:
          - name: default
            host: 127.0.0.1
            port: 8080
            max_connections: 800
            first_byte_timeout: 600s
            connect_timeout: 600s
            between_bytes_timeout: 600s
            probe_enabled: true
            probe:
              url: "/"
              timeout: 5s
              interval: 30s
              window: 5
              threshold: 3
            requests:
              - url: "/"
                ttl: 1m
                grace: 10m
                keep: 20m
          - name: default2
            host: 127.0.0.1
            port: 8081
            max_connections: 800
            first_byte_timeout: 600s
            connect_timeout: 600s
            between_bytes_timeout: 600s
            probe_enabled: true
            probe:
              url: "/"
              timeout: 5s
              interval: 30s
              window: 5
              threshold: 3
            requests:
              - url: "/"

Uninstallation

- hosts: varnish
  become: true
  roles:
    - role: bilalcaliskan.varnish
      vars:
        varnish_install: false

Development

This project requires below tools for development:

After you install all the tools above, you can simply configure pre-commit by typing:

$ pre-commit install

License

Apache License 2.0

About

An Ansible role which installs and configures Varnish Cache on Redhat based hosts

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published