73 lines
1.8 KiB
YAML
Executable File
73 lines
1.8 KiB
YAML
Executable File
---
|
|
- hosts: all
|
|
become: True
|
|
|
|
tasks:
|
|
- name: Create conf directory
|
|
ansible.builtin.file:
|
|
path: /etc/systemd/system/varnish.service.d
|
|
state: directory
|
|
mode: '0655'
|
|
|
|
- name: Dropping config in conf directory
|
|
ansible.builtin.template:
|
|
src: templates/customexec.conf.j2
|
|
dest: /etc/systemd/system/varnish.service.d/customexec.conf
|
|
mode: '0655'
|
|
owner: root
|
|
group: root
|
|
|
|
- name: Dropping Varnish config (default.vcl)
|
|
ansible.builtin.template:
|
|
src: templates/default.vcl.j2
|
|
dest: /etc/varnish/default.vcl
|
|
mode: '0644'
|
|
force: yes
|
|
|
|
- name: Reload daemons, enable varnish
|
|
ansible.builtin.systemd:
|
|
daemon_reload: yes
|
|
name: varnish.service
|
|
enabled: no
|
|
state: stopped
|
|
|
|
- name: Modfying Apache default port
|
|
ansible.builtin.lineinfile:
|
|
path: /etc/apache2/ports.conf
|
|
regexp: '^Listen 8080$'
|
|
line: 'Listen 80'
|
|
|
|
- name: Find all enabled vhosts
|
|
ansible.builtin.find:
|
|
paths: /etc/apache2/sites-available
|
|
patterns: "*.conf"
|
|
follow: yes
|
|
file_type: file
|
|
register: vhosts
|
|
|
|
- name: dbg
|
|
ansible.builtin.debug:
|
|
var: vhosts.files
|
|
|
|
- name: Modfying VHosts
|
|
ansible.builtin.replace:
|
|
path: "{{ item.path }}"
|
|
regexp: '^\<[Vv]irtual[Hh]ost \*:8080\>$'
|
|
replace: "<VirtualHost *:80>"
|
|
with_items:
|
|
- "{{ vhosts.files }}"
|
|
|
|
- name: Activating Apache Headers Mod
|
|
community.general.apache2_module:
|
|
state: present
|
|
name: headers
|
|
identifier: headers_module
|
|
|
|
- name: Restart Varnish and Apache
|
|
ansible.builtin.systemd:
|
|
name: "{{ item }}"
|
|
state: restarted
|
|
with_items:
|
|
- "apache2.service"
|
|
|