varnish: validate configuration

This commit is contained in:
Jérémy Lecour 2021-09-16 17:22:27 +02:00 committed by Jérémy Lecour
parent 2b549af7d9
commit fac6e15633
2 changed files with 34 additions and 24 deletions

View file

@ -23,6 +23,7 @@ The **patch** part changes incrementally at each release.
* nagios-nrpe + evolinux-users: new checks for bkctld
* redis: instance service for Debian 11
* squid: add *.o.lencr.org to default whitelist
* varnish: validate configuration
### Changed

View file

@ -43,6 +43,9 @@
src: varnish.conf.jessie.j2
dest: /etc/systemd/system/varnish.service.d/evolinux.conf
force: yes
owner: root
group: root
mode: "0644"
when: ansible_distribution_major_version is version('10', '<')
notify:
- reload systemd
@ -58,6 +61,9 @@
src: varnish.conf.buster.j2
dest: /etc/systemd/system/varnish.service.d/evolinux.conf
force: yes
owner: root
group: root
mode: "0644"
when: ansible_distribution_major_version is version('10', '>=')
notify:
- reload systemd
@ -79,12 +85,39 @@
- varnish
- logrotate
- name: Create Varnish config dir
file:
path: /etc/varnish/conf.d
state: directory
mode: "0755"
tags:
- varnish
- config
- update-config
# First, copy included files
- name: Copy included Varnish config
template:
src: "{{ item }}"
dest: /etc/varnish/conf.d/
mode: "0644"
force: yes
with_fileglob:
- "templates/varnish/conf.d/*.vcl"
notify: reload varnish
tags:
- varnish
- config
- update-config
# Then, copy main configuration
- name: Copy Varnish configuration
template:
src: "{{ item }}"
dest: "{{ varnish_config_file }}"
mode: "0644"
force: yes
validate: "varnishd -Cf %s > /dev/null"
loop: "{{ query('first_found', templates) }}"
vars:
templates:
@ -102,28 +135,4 @@
- config
- update-config
- name: Create Varnish config dir
file:
path: /etc/varnish/conf.d
state: directory
mode: "0755"
tags:
- varnish
- config
- update-config
- name: Copy included Varnish config
template:
src: "{{ item }}"
dest: /etc/varnish/conf.d/
force: yes
mode: "0644"
with_fileglob:
- "templates/varnish/conf.d/*.vcl"
notify: reload varnish
tags:
- varnish
- config
- update-config
- include: munin.yml