varnish: New repository configuration.

This commit is contained in:
Andrea Dell'Amico 2017-10-28 13:25:59 +02:00
parent 907ef0dc0e
commit ec0e450d83
2 changed files with 8 additions and 11 deletions

View File

@ -1,9 +1,11 @@
---
varnish_version: 4.0
varnish_version: 4
varnish_compact_ver: 41
varnish_repo: True
varnish_repo_requirements:
- apt-transport-https
varnish_repo_url: "https://repo.varnish-cache.org/debian/ {{ ansible_distribution_release }} varnish-{{ varnish_version }}"
- debian-archive-keyring
varnish_repo_url: "deb https://packagecloud.io/varnishcache/varnish{{ varnish_compact_ver }}/ubuntu/ {{ ansible_distribution_release }} main"
varnish_pkg_name: varnish
varnish_pkg_state: present
varnish_enabled: True

View File

@ -1,29 +1,24 @@
---
- name: Install the required packages needed by the external varnish repo
apt: pkg={{ item }} state=present
apt: pkg={{ item }} state=present cache_valid_time=1800 update_cache=yes
with_items: '{{ varnish_repo_requirements }}'
when: varnish_repo
tags: varnish
- name: Get the varnish repo key
apt_key: url=https://repo.varnish-cache.org/GPG-key.txt state=present
apt_key: url=https://packagecloud.io/varnishcache/varnish{{ varnish_compact_ver }}/gpgkey state=present
when: varnish_repo
register: varnish_repo_list
tags: varnish
- name: Define the varnish repository
apt_repository: repo='deb {{ varnish_repo_url }}' state=present
apt_repository: repo='{{ varnish_repo_url }}' state=present update_cache=yes
when: varnish_repo
register: varnish_repo_list
tags: varnish
- name: Update the apt cache if needed
apt: update_cache=yes
when: ( varnish_repo_list | changed )
tags: varnish
- name: Install the varnish package
apt: pkg={{ item }} state={{ varnish_pkg_state }}
apt: pkg={{ item }} state={{ varnish_pkg_state }} cache_valid_time=1800 update_cache=yes
with_items: '{{ varnish_pkg_name }}'
tags: varnish