-
Notifications
You must be signed in to change notification settings - Fork 0
/
proxy.yml
79 lines (69 loc) · 2.15 KB
/
proxy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
- hosts: proxy
roles:
- common
- apache
tasks:
- name: Set Apache ServerTokens directive to ProductOnly
lineinfile: dest=/etc/apache2/apache2.conf line="ServerTokens Prod"
notify:
- reload apache2
sudo: yes
- name: Set Apache ServerSignature directive to Off
lineinfile: dest=/etc/apache2/apache2.conf line="ServerSignature Off"
notify:
- reload apache2
sudo: yes
- name: Disable Apache icons alias
lineinfile: dest=/etc/apache2/mods-available/alias.conf state=absent regexp="Alias /icons/ \"/usr/share/apache2/icons/\""
notify:
- reload apache2
sudo: yes
- name: Install Apache proxy module
apt: pkg=libapache2-mod-proxy-html state=installed update_cache=true
environment: "{{ proxy_env }}"
sudo: yes
- name: Enable apache proxy modules
shell: a2enmod {{item}}
with_items:
- proxy
- proxy_ajp
- proxy_http
- rewrite
- deflate
- headers
- proxy_balancer
- proxy_connect
- proxy_html
- xml2enc
- ssl
notify:
- reload apache2
sudo: yes
- name: create virtual host file
template: src=templates/proxy-vhost.conf dest=/etc/apache2/sites-available/{{ proxy_vhost }}.conf
when: (proxy_ssl_cert is not defined) or (proxy_ssl_key is not defined) or (proxy_ssl_chain is not defined)
notify:
- reload apache2
sudo: yes
- name: create https virtual host file
template: src=templates/proxy-vhost-https.conf dest=/etc/apache2/sites-available/{{ proxy_vhost }}.conf
when: (proxy_ssl_cert is defined) and (proxy_ssl_key is defined) and (proxy_ssl_chain is defined)
notify:
- reload apache2
sudo: yes
- name: a2ensite {{ proxy_vhost }}
command: a2ensite {{ proxy_vhost }}
notify:
- reload apache2
sudo: yes
- name: a2dissite 000-default
command: a2dissite 000-default
notify:
- reload apache2
sudo: yes
- name: reload apache2
service: name=apache2 state=reloaded
notify:
- reload apache2
sudo: yes