-
-
Notifications
You must be signed in to change notification settings - Fork 174
/
Copy pathsetup-nginx.yml
82 lines (69 loc) · 1.84 KB
/
setup-nginx.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
80
81
82
- name: nginx - system user
user: name=nginx
# Kong installation steps from http://archive.vn/3HRQx
- name: nginx - system dependencies
apt:
pkg:
- openssl
- libpcre3-dev
- libssl-dev
- zlib1g-dev
- name: nginx - download source
get_url:
url: "https://nginx.org/download/nginx-{{ nginx_release }}.tar.gz"
dest: /tmp/nginx-{{ nginx_release }}.tar.gz
checksum: "{{ nginx_release_checksum }}"
- name: nginx - unpack archive
unarchive:
remote_src: yes
src: /tmp/nginx-{{ nginx_release }}.tar.gz
dest: /tmp
- name: nginx - configure
shell:
chdir: /tmp/nginx-{{ nginx_release }}
cmd: |
set -e
./configure \
--prefix=/usr/local/nginx \
--conf-path=/etc/nginx/nginx.conf \
--with-http_ssl_module \
--with-http_realip_module \
--with-threads
become: yes
- name: nginx - build
community.general.make:
target: build
chdir: /tmp/nginx-{{ nginx_release }}
jobs: "{{ parallel_jobs | default(omit) }}"
become: yes
- name: nginx - install
make:
chdir: /tmp/nginx-{{ nginx_release }}
target: install
become: yes
- name: nginx - hand over ownership of /usr/local/nginx to user nginx
file:
path: /usr/local/nginx
recurse: yes
owner: nginx
- name: nginx - hand over ownership of /etc/nginx to user nginx
file:
path: /etc/nginx
recurse: yes
owner: nginx
# [warn] ulimit is currently set to "1024". For better performance set it to at least
# "4096" using "ulimit -n"
- name: nginx - bump up ulimit
pam_limits:
limit_item: nofile
limit_type: soft
domain: nginx
value: "4096"
- name: nginx - create service file
template:
src: files/nginx.service.j2
dest: /etc/systemd/system/nginx.service
# Keep it dormant for the timebeing
# - name: nginx - reload systemd
# systemd:
# daemon_reload: yes