Skip to content

Commit f78bb90

Browse files
committed
Add example playbooks
1 parent fc4c92b commit f78bb90

11 files changed

+380
-9
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## 0.2.0 (September 23, 2020)
4+
5+
Add example playbooks covering a wide range of use cases.
6+
37
## 0.1.0 (September 23, 2020)
48

59
Initial release of the Ansible NGINX collection.

README.md

+18-8
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ The Ansible NGINX collection includes the following roles:
1212

1313
|Name|Description|Version|
1414
|----|-----------|-------|
15-
[nginxinc.nginx](https://github.com/nginxinc/ansible-role-nginx)|Install NGINX|0.17.1
16-
[nginxinc.nginx_config](https://github.com/nginxinc/ansible-role-nginx-config)|Configure NGINX|0.2.0
17-
[nginxinc.nginx_app_protect](https://github.com/nginxinc/ansible-role-nginx-app-protect)|Install and configure NGINX App Protect|0.3.1
15+
|[nginxinc.nginx](https://github.com/nginxinc/ansible-role-nginx)|Install NGINX|0.17.1|
16+
|[nginxinc.nginx_config](https://github.com/nginxinc/ansible-role-nginx-config)|Configure NGINX|0.2.0|
17+
|[nginxinc.nginx_app_protect](https://github.com/nginxinc/ansible-role-nginx-app-protect)|Install and configure NGINX App Protect|0.3.1|
1818

1919
Requirements
2020
------------
@@ -36,22 +36,32 @@ You can also include the collection in a `requirements.yml` file and install it
3636
---
3737
collections:
3838
- name: nginxinc.nginx_core
39-
version: 0.1.0
39+
version: 0.1.1
4040
```
4141
4242
**Git**
4343
4444
Use `git clone https://github.com/nginxinc/ansible-collection-nginx.git` to pull the latest edge commit of the collection from GitHub.
4545

46-
Usage **(WIP)**
47-
---------------
46+
Usage
47+
-----
4848

49-
Sample playbooks for each use case covered by this collection will be found in the `playbooks/` folder.
49+
Sample playbooks for each use case covered by this collection can be found in the `playbooks/` folder:
50+
51+
|Name|Description|
52+
|----|-----------|
53+
|[`deploy-nginx.yml`](https://github.com/nginxinc/ansible-collection-nginx/blob/main/playbooks/deploy-nginx.yml)|Install NGINX|
54+
|[`deploy-nginx-plus.yml`](https://github.com/nginxinc/ansible-collection-nginx/blob/main/playbooks/deploy-nginx-plus.yml)|Install NGINX Plus|
55+
|[`deploy-nginx-app-protect.yml`](https://github.com/nginxinc/ansible-collection-nginx/blob/main/playbooks/deploy-nginx-app-protect.yml)|Install NGINX App Protect|
56+
|[`deploy-nginx-plus-app-protect.yml`](https://github.com/nginxinc/ansible-collection-nginx/blob/main/playbooks/deploy-nginx-plus-app-protect.yml)|Install NGINX Plus and NGINX App Protect|
57+
|[`deploy-nginx-web-server.yml`](https://github.com/nginxinc/ansible-collection-nginx/blob/main/playbooks/deploy-nginx-web-server.yml)|Install NGINX and configure a simple web server|
58+
|[`deploy-nginx-web-server-proxy.yml`](https://github.com/nginxinc/ansible-collection-nginx/blob/main/playbooks/deploy-nginx-web-server-proxy.yml)|Install NGINX and configure a simple reverse proxy in front of two web servers|
59+
|[`deploy-nginx-plus-app-protect-web-server-proxy.yml`](https://github.com/nginxinc/ansible-collection-nginx/blob/main/playbooks/deploy-nginx-plus-app-protect-web-server-proxy.yml)|Install NGINX Plus and NGINX App Protect and configure a simple reverse proxy in front of two web servers protected by NGINX App Protect|
5060

5161
Development
5262
-----------
5363

54-
Currently, all the NGINX roles (inside `roles/`) are Git submodules, and work on the roles themselves should take place in the upstream Role repository. At some point, the roles might move into this repository for their canonical home.
64+
Currently, all the NGINX roles (inside `roles/`) are Git submodules, and work on the roles themselves should take place in the upstream role repository.
5565

5666
To update the roles included in this collection to their latest version, run:
5767

galaxy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
namespace: nginxinc
33
name: nginx_core
44
description: Install and configure NGINX and NGINX App Protect using Ansible
5-
version: 0.1.0
5+
version: 0.1.1
66
readme: README.md
77
license_file: LICENSE
88
authors:

playbooks/.gitkeep

Whitespace-only changes.
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
- hosts: all
3+
collections:
4+
- nginxinc.nginx_core
5+
roles:
6+
- role: nginx_app_protect
7+
vars:
8+
nginx_app_protect_license:
9+
certificate: <path/to/certificate>
10+
key: <path/to/key>
11+
nginx_app_protect_remove_license: false
12+
nginx_app_protect_install_signatures: true
13+
nginx_app_protect_install_threat_campaigns: true
14+
nginx_app_protect_configure: true
15+
nginx_app_protect_security_policy_template_enable: true
16+
nginx_app_protect_security_policy_enforcement_mode: blocking
17+
nginx_app_protect_log_policy_template_enable: true
18+
nginx_app_protect_log_policy_filter_request_type: all
19+
nginx_app_protect_conf_template_enable: false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
---
2+
- hosts: all
3+
collections:
4+
- nginxinc.nginx_core
5+
roles:
6+
- role: nginx
7+
vars:
8+
nginx_type: plus
9+
nginx_license:
10+
certificate: <path/to/certificate>
11+
key: <path/to/key>
12+
nginx_remove_license: false
13+
- role: nginx_app_protect
14+
vars:
15+
nginx_app_protect_setup_license: false
16+
nginx_app_protect_remove_license: false
17+
nginx_app_protect_install_signatures: true
18+
nginx_app_protect_install_threat_campaigns: true
19+
nginx_app_protect_configure: true
20+
nginx_app_protect_security_policy_template_enable: true
21+
nginx_app_protect_security_policy_enforcement_mode: blocking
22+
nginx_app_protect_log_policy_template_enable: true
23+
nginx_app_protect_log_policy_filter_request_type: all
24+
nginx_app_protect_conf_template_enable: false
25+
- role: nginx_config
26+
vars:
27+
nginx_config_modules:
28+
- modules/ngx_http_app_protect_module.so
29+
nginx_config_http_template_enable: true
30+
nginx_config_http_template:
31+
app:
32+
template_file: http/default.conf.j2
33+
conf_file_name: default.conf
34+
conf_file_location: /etc/nginx/conf.d/
35+
servers:
36+
main:
37+
app_protect:
38+
enable: true
39+
policy_file: /etc/nginx/app-protect-security-policy.json
40+
security_log_enable: true
41+
security_log:
42+
path: /etc/nginx/app-protect-log-policy.json
43+
dest: /var/log/app_protect/security.log
44+
listen:
45+
listen_localhost:
46+
port: 80
47+
server_name: localhost
48+
access_log:
49+
- name: main
50+
location: /var/log/nginx/access.log
51+
reverse_proxy:
52+
locations:
53+
main:
54+
location: /
55+
proxy_pass: http://upstr/
56+
proxy_set_header:
57+
header_host:
58+
name: Host
59+
value: $host
60+
server_one:
61+
listen:
62+
listen_server_one:
63+
port: 8081
64+
server_name: localhost
65+
access_log:
66+
- name: main
67+
location: /var/log/nginx/access.log
68+
web_server:
69+
locations:
70+
server_one:
71+
location: /
72+
html_file_location: /usr/share/nginx/html
73+
html_file_name: server_one.html
74+
sub_filter:
75+
once: false
76+
sub_filters:
77+
- "'server_hostname' '$hostname'"
78+
- "'server_address' '$server_addr:$server_port'"
79+
- "'server_url' '$request_uri'"
80+
- "'remote_addr' '$remote_addr:$remote_port'"
81+
- "'server_date' '$time_local'"
82+
- "'client_browser' '$http_user_agent'"
83+
- "'request_id' '$request_id'"
84+
- "'nginx_version' '$nginx_version'"
85+
- "'document_root' '$document_root'"
86+
- "'proxied_for_ip' '$http_x_forwarded_for'"
87+
server_two:
88+
listen:
89+
listen_server_two:
90+
port: 8082
91+
server_name: localhost
92+
access_log:
93+
- name: main
94+
location: /var/log/nginx/access.log
95+
web_server:
96+
locations:
97+
server_two:
98+
location: /
99+
html_file_location: /usr/share/nginx/html
100+
html_file_name: server_two.html
101+
sub_filter:
102+
once: false
103+
sub_filters:
104+
- "'server_hostname' '$hostname'"
105+
- "'server_address' '$server_addr:$server_port'"
106+
- "'server_url' '$request_uri'"
107+
- "'remote_addr' '$remote_addr:$remote_port'"
108+
- "'server_date' '$time_local'"
109+
- "'client_browser' '$http_user_agent'"
110+
- "'request_id' '$request_id'"
111+
- "'nginx_version' '$nginx_version'"
112+
- "'document_root' '$document_root'"
113+
- "'proxied_for_ip' '$http_x_forwarded_for'"
114+
upstreams:
115+
main:
116+
name: upstr
117+
lb_method: least_conn
118+
servers:
119+
server_one:
120+
address: 0.0.0.0
121+
port: 8081
122+
server_two:
123+
address: 0.0.0.0
124+
port: 8082
125+
126+
nginx_config_html_demo_template_enable: true
127+
nginx_config_html_demo_template:
128+
server_one:
129+
template_file: www/index.html.j2
130+
html_file_name: server_one.html
131+
html_file_location: /usr/share/nginx/html
132+
web_server_name: Ansible NGINX collection - Server one
133+
server_two:
134+
template_file: www/index.html.j2
135+
html_file_name: server_two.html
136+
html_file_location: /usr/share/nginx/html
137+
web_server_name: Ansible NGINX collection - Server two
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
- hosts: all
3+
collections:
4+
- nginxinc.nginx_core
5+
roles:
6+
- role: nginx
7+
vars:
8+
nginx_type: plus
9+
nginx_license:
10+
certificate: <path/to/certificate>
11+
key: <path/to/key>
12+
nginx_remove_license: false
13+
- role: nginx_app_protect
14+
vars:
15+
nginx_app_protect_setup_license: false
16+
nginx_app_protect_remove_license: true
17+
nginx_app_protect_install_signatures: true
18+
nginx_app_protect_install_threat_campaigns: true
19+
nginx_app_protect_configure: true
20+
nginx_app_protect_security_policy_template_enable: true
21+
nginx_app_protect_security_policy_enforcement_mode: blocking
22+
nginx_app_protect_log_policy_template_enable: true
23+
nginx_app_protect_log_policy_filter_request_type: all
24+
nginx_app_protect_conf_template_enable: false

playbooks/deploy-nginx-plus.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
- hosts: all
3+
collections:
4+
- nginxinc.nginx_core
5+
roles:
6+
- role: nginx
7+
vars:
8+
nginx_type: plus
9+
nginx_license:
10+
certificate: <path/to/certificate>
11+
key: <path/to/key>
+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
---
2+
- hosts: all
3+
collections:
4+
- nginxinc.nginx_core
5+
roles:
6+
- role: nginx
7+
- role: nginx_config
8+
vars:
9+
nginx_config_http_template_enable: true
10+
nginx_config_http_template:
11+
app:
12+
template_file: http/default.conf.j2
13+
conf_file_name: default.conf
14+
conf_file_location: /etc/nginx/conf.d/
15+
servers:
16+
main:
17+
listen:
18+
listen_localhost:
19+
port: 80
20+
server_name: localhost
21+
access_log:
22+
- name: main
23+
location: /var/log/nginx/access.log
24+
reverse_proxy:
25+
locations:
26+
main:
27+
location: /
28+
proxy_pass: http://upstr/
29+
proxy_set_header:
30+
header_host:
31+
name: Host
32+
value: $host
33+
server_one:
34+
listen:
35+
listen_server_one:
36+
port: 8081
37+
server_name: localhost
38+
access_log:
39+
- name: main
40+
location: /var/log/nginx/access.log
41+
web_server:
42+
locations:
43+
server_one:
44+
location: /
45+
html_file_location: /usr/share/nginx/html
46+
html_file_name: server_one.html
47+
sub_filter:
48+
once: false
49+
sub_filters:
50+
- "'server_hostname' '$hostname'"
51+
- "'server_address' '$server_addr:$server_port'"
52+
- "'server_url' '$request_uri'"
53+
- "'remote_addr' '$remote_addr:$remote_port'"
54+
- "'server_date' '$time_local'"
55+
- "'client_browser' '$http_user_agent'"
56+
- "'request_id' '$request_id'"
57+
- "'nginx_version' '$nginx_version'"
58+
- "'document_root' '$document_root'"
59+
- "'proxied_for_ip' '$http_x_forwarded_for'"
60+
server_two:
61+
listen:
62+
listen_server_two:
63+
port: 8082
64+
server_name: localhost
65+
access_log:
66+
- name: main
67+
location: /var/log/nginx/access.log
68+
web_server:
69+
locations:
70+
server_two:
71+
location: /
72+
html_file_location: /usr/share/nginx/html
73+
html_file_name: server_two.html
74+
sub_filter:
75+
once: false
76+
sub_filters:
77+
- "'server_hostname' '$hostname'"
78+
- "'server_address' '$server_addr:$server_port'"
79+
- "'server_url' '$request_uri'"
80+
- "'remote_addr' '$remote_addr:$remote_port'"
81+
- "'server_date' '$time_local'"
82+
- "'client_browser' '$http_user_agent'"
83+
- "'request_id' '$request_id'"
84+
- "'nginx_version' '$nginx_version'"
85+
- "'document_root' '$document_root'"
86+
- "'proxied_for_ip' '$http_x_forwarded_for'"
87+
upstreams:
88+
main:
89+
name: upstr
90+
lb_method: least_conn
91+
servers:
92+
server_one:
93+
address: 0.0.0.0
94+
port: 8081
95+
server_two:
96+
address: 0.0.0.0
97+
port: 8082
98+
99+
nginx_config_html_demo_template_enable: true
100+
nginx_config_html_demo_template:
101+
server_one:
102+
template_file: www/index.html.j2
103+
html_file_name: server_one.html
104+
html_file_location: /usr/share/nginx/html
105+
web_server_name: Ansible NGINX collection - Server one
106+
server_two:
107+
template_file: www/index.html.j2
108+
html_file_name: server_two.html
109+
html_file_location: /usr/share/nginx/html
110+
web_server_name: Ansible NGINX collection - Server two

0 commit comments

Comments
 (0)