File tree 5 files changed +20
-9
lines changed
5 files changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ Ansible is a radically simple IT automation system. It handles configuration man
76
76
77
77
** VS Code config hints:**
78
78
79
- For better readability, please add two association to your ` .vscode/settings.json ` :
79
+ For better readability, please add two association to your ` .vscode/settings.json ` :
80
80
81
81
1 . For ` Ansible ` playbooks
82
82
2 . For ` jinja2 ` templates (which uses for ` Nginx ` configs)
@@ -164,11 +164,12 @@ ansible-playbook \
164
164
165
165
** Features:**
166
166
167
+ - Added lines to files:
168
+ - ` load_module ` lines with Brotli module to the start of Nginx config (` /etc/nginx/nginx.conf ` )
167
169
- Installed latest versions:
168
170
- [ ` Brotli ` ] ( https://github.com/google/brotli )
169
171
- [ ` Brotli module ` ] ( https://github.com/google/ngx_brotli ) for Nginx
170
172
- Configured by the best practice:
171
- - Nginx
172
173
- Brotli
173
174
174
175
** Tested to work:**
Original file line number Diff line number Diff line change 1
- # Add Brotli modules
2
- load_module "modules/ngx_http_brotli_filter_module.so" ;
3
- load_module "modules/ngx_http_brotli_static_module.so" ;
4
-
5
1
# Start NGINX configuration
6
2
worker_processes auto;
7
3
Original file line number Diff line number Diff line change 8
8
apt :
9
9
pkg : software-properties-common
10
10
state : latest
11
+ when : ansible_distribution == 'Ubuntu' and ansible_distribution_release != 'focal'
11
12
12
13
- name : Add PPA repositories
13
14
apt_repository :
14
15
repo : " {{ item.repo }}"
15
16
with_items :
16
17
- { repo: "ppa:certbot/certbot" }
18
+ when : ansible_distribution == 'Ubuntu' and ansible_distribution_release != 'focal'
17
19
18
20
- name : Update dist
19
21
apt :
43
45
src : ./templates/http-domain.j2
44
46
dest : /etc/nginx/sites-available/{{ domain }}.conf
45
47
46
- - name : Create symbolic link for {{ domain }}.conf to /etc/nginx/sites-enabled/
48
+ - name : Create symbolic link for {{ domain }}.conf to /etc/nginx/sites-enabled
47
49
file :
48
50
state : link
49
51
src : /etc/nginx/sites-available/{{ domain }}.conf
50
- dest : /etc/nginx/sites-enabled/
52
+ dest : /etc/nginx/sites-enabled/{{ domain }}.conf
53
+ owner : " {{ ansible_user }}"
54
+ group : " {{ ansible_user }}"
55
+ mode : 0644
51
56
notify :
52
57
- restart_nginx
53
58
Original file line number Diff line number Diff line change 52
52
- { src: "~/nginx-{{ nginx_version }}/objs/ngx_http_brotli_filter_module.so", dest: "/usr/share/nginx/modules" }
53
53
- { src: "~/nginx-{{ nginx_version }}/objs/ngx_http_brotli_static_module.so", dest: "/usr/share/nginx/modules" }
54
54
55
+ - name : Add Brotli module to start of Nginx config
56
+ lineinfile :
57
+ path : /etc/nginx/nginx.conf
58
+ insertbefore : BOF
59
+ line : " {{ item.line }}"
60
+ with_items :
61
+ - { line: 'load_module "modules/ngx_http_brotli_filter_module.so";' }
62
+ - { line: 'load_module "modules/ngx_http_brotli_static_module.so";' }
63
+
55
64
- name : Copy Brotli config
56
65
copy :
57
66
src : " {{ item.src }}"
60
69
group : " {{ ansible_user }}"
61
70
mode : 0644
62
71
with_items :
63
- - { src: "./configs/nginx.conf", dest: "/etc/nginx/nginx.conf" }
64
72
- { src: "./configs/brotli.conf", dest: "/etc/nginx/conf.d/brotli.conf" }
65
73
notify :
66
74
- restart_nginx
Original file line number Diff line number Diff line change 8
8
apt :
9
9
pkg : software-properties-common
10
10
state : latest
11
+ when : ansible_distribution == 'Ubuntu' and ansible_distribution_release != 'focal'
11
12
12
13
- name : Add PPA repositories
13
14
apt_repository :
You can’t perform that action at this time.
0 commit comments