Skip to content

Commit 44a74aa

Browse files
authored
Merge pull request #61 from nginxinc/rename-variables
Rename variables
2 parents 7785691 + 27c4069 commit 44a74aa

26 files changed

+154
-154
lines changed

README.md

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,13 @@ nginx_enable: true
173173
# Specify which version of NGINX you want to install.
174174
# Options are 'opensource' or 'plus'.
175175
# Default is 'opensource'.
176-
type: opensource
176+
nginx_type: opensource
177177

178178
# Specify repository origin for NGINX Open Source.
179179
# Options are 'nginx_repository' or 'os_repository'.
180-
# Only works if 'type' is set to 'opensource'.
180+
# Only works if 'nginx_type' is set to 'opensource'.
181181
# Default is nginx_repository.
182-
install_from: nginx_repository
182+
nginx_install_from: nginx_repository
183183

184184
# Specify source repository for NGINX Open Source.
185185
# Only works if 'install_from' is set to 'nginx_repository'.
@@ -197,21 +197,21 @@ nginx_repository:
197197
# Options are 'mainline' or 'stable'.
198198
# Only works if 'install_from' is set to 'nginx_repository'.
199199
# Default is mainline.
200-
branch: mainline
200+
nginx_branch: mainline
201201

202202
# Location of your NGINX Plus license in your local machine.
203203
# Default is the files folder within the NGINX Ansible role.
204-
license:
204+
nginx_license:
205205
certificate: license/nginx-repo.crt
206206
key: license/nginx-repo.key
207207

208208
# Delete NGINX Plus license after installation for security purposes.
209209
# Default is true.
210-
delete_license: true
210+
nginx_delete_license: true
211211

212212
# Install NGINX JavaScript, Perl, ModSecurity WAF (NGINX Plus only), GeoIP, Image-Filter, RTMP Media Streaming, and/or XSLT modules.
213213
# Default is false.
214-
modules:
214+
nginx_modules:
215215
njs: false
216216
perl: false
217217
waf: false
@@ -224,58 +224,58 @@ modules:
224224
# Use your NGINX Amplify API key.
225225
# Requires access to either the NGINX stub status or the NGINX Plus REST API.
226226
# Default is null.
227-
amplify_enable: false
228-
amplify_api_key: null
227+
nginx_amplify_enable: false
228+
nginx_amplify_api_key: null
229229

230230
# Install NGINX Controller.
231231
# Use your NGINX Controller API key and NGINX Controller API endpoint.
232232
# Requires NGINX Plus and write access to the NGINX Plus REST API.
233233
# Default is null.
234-
controller_enable: false
235-
controller_api_key: null
236-
controller_api_endpoint: null
234+
nginx_controller_enable: false
235+
nginx_controller_api_key: null
236+
nginx_controller_api_endpoint: null
237237

238238
# Install NGINX Unit and NGINX Unit modules.
239239
# Use a list of supported NGINX Unit modules.
240240
# Default is false.
241-
unit_enable: false
242-
unit_modules: null
241+
nginx_unit_enable: false
242+
nginx_unit_modules: null
243243

244244
# Enable NGINX status data.
245245
# Will enable 'stub_status' in NGINX Open Source and 'status' in NGINX Plus.
246246
# Default is false.
247-
status_enable: false
247+
nginx_status_enable: false
248248

249249
# Enable NGINX Plus REST API, write access to the REST API, and NGINX Plus dashboard.
250250
# Requires NGINX Plus.
251251
# Default is false.
252-
rest_api_enable: false
253-
rest_api_write: false
254-
rest_api_dashboard: false
252+
nginx_rest_api_enable: false
253+
nginx_rest_api_write: false
254+
nginx_rest_api_dashboard: false
255255

256256
# Enable uploading NGINX configuration files to your system.
257257
# Default for uploading files is false.
258258
# Default location of files is the files folder within the NGINX Ansible role.
259-
main_push_enable: false
260-
main_push_location: conf/nginx.conf
261-
http_push_enable: false
262-
http_push_location: conf/http/*.conf
263-
stream_push_enable: false
264-
stream_push_location: conf/stream/*.conf
259+
nginx_main_push_enable: false
260+
nginx_main_push_location: conf/nginx.conf
261+
nginx_http_push_enable: false
262+
nginx_http_push_location: conf/http/*.conf
263+
nginx_stream_push_enable: false
264+
nginx_stream_push_location: conf/stream/*.conf
265265

266266
# Configuration variables to create a templated NGINX configuration.
267267
# Defaults are the values found in a fresh NGINX installation.
268-
main_template_enable: false
269-
main_template_user: nginx
270-
main_template_worker_processes: auto
271-
main_template_error_level: warn
272-
main_template_worker_connections: 1024
273-
http_template_enable: false
274-
http_template_keepalive_timeout: 65
275-
http_template_listen: 80
276-
http_template_server_name: localhost
277-
stream_template_enable: false
278-
stream_template_listen: 12345
268+
nginx_main_template_enable: false
269+
nginx_main_template_user: nginx
270+
nginx_main_template_worker_processes: auto
271+
nginx_main_template_error_level: warn
272+
nginx_main_template_worker_connections: 1024
273+
nginx_http_template_enable: false
274+
nginx_http_template_keepalive_timeout: 65
275+
nginx_http_template_listen: 80
276+
nginx_http_template_server_name: localhost
277+
nginx_stream_template_enable: false
278+
nginx_stream_template_listen: 12345
279279
```
280280
281281
Dependencies
@@ -315,7 +315,7 @@ This is a sample playbook file for deploying the Ansible Galaxy NGINX role in a
315315
roles:
316316
- role: nginxinc.nginx
317317
vars:
318-
type: plus
318+
nginx_type: plus
319319
```
320320

321321
This is a sample playbook file for deploying the Ansible Galaxy NGINX role in a localhost to install NGINX Plus and the NGINX Controller agent.
@@ -326,12 +326,12 @@ This is a sample playbook file for deploying the Ansible Galaxy NGINX role in a
326326
roles:
327327
- role: nginxinc.nginx
328328
vars:
329-
type: plus
330-
rest_api_enable: true
331-
rest_api_write: true
332-
controller_enable: true
333-
controller_api_key: <API_KEY_HERE>
334-
controller_api_endpoint: https://<FQDN>/1.4
329+
nginx_type: plus
330+
nginx_rest_api_enable: true
331+
nginx_rest_api_write: true
332+
nginx_controller_enable: true
333+
nginx_controller_api_key: <API_KEY_HERE>
334+
nginx_controller_api_endpoint: https://<FQDN>/1.4
335335
```
336336

337337
This is a sample playbook file for deploying the Ansible Galaxy NGINX role in a localhost to install NGINX Unit and the PHP/Perl NGINX Unit language modules.
@@ -344,8 +344,8 @@ This is a sample playbook file for deploying the Ansible Galaxy NGINX role in a
344344
- role: nginxinc.nginx
345345
vars:
346346
nginx_enable: false
347-
unit_enable: true
348-
unit_modules:
347+
nginx_unit_enable: true
348+
nginx_unit_modules:
349349
- unit-php
350350
- unit-perl
351351
```

defaults/main.yml

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,45 @@ nginx_enable: true
66
# Specify which version of NGINX you want to install.
77
# Options are 'opensource' or 'plus'.
88
# Default is 'opensource'.
9-
type: opensource
9+
nginx_type: opensource
1010

1111
# Specify repository origin for NGINX Open Source.
1212
# Options are 'nginx_repository' or 'os_repository'.
13-
# Only works if 'type' is set to 'opensource'.
13+
# Only works if 'nginx_type' is set to 'opensource'.
1414
# Default is nginx_repository.
15-
install_from: nginx_repository
15+
nginx_install_from: nginx_repository
1616

1717
# Specify source repository for NGINX Open Source.
1818
# Only works if 'install_from' is set to 'nginx_repository'.
1919
# Defaults are the official NGINX repositories.
2020
nginx_repository:
2121
debian:
22-
- deb https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/', '') }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
23-
- deb-src https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/', '') }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
22+
- deb https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
23+
- deb-src https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
2424
redhat:
25-
- https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/', '') }}{{ (ansible_distribution == "RedHat") | ternary('rhel/', 'centos/') }}{{ ansible_distribution_major_version|int }}/$basearch/
25+
- https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}{{ (ansible_distribution == "RedHat") | ternary('rhel/', 'centos/') }}{{ ansible_distribution_major_version|int }}/$basearch/
2626
suse:
27-
- https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/', '') }}sles/12
27+
- https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}sles/12
2828

2929
# Specify which branch of NGINX Open Source you want to install.
3030
# Options are 'mainline' or 'stable'.
3131
# Only works if 'install_from' is set to 'nginx_repository'.
3232
# Default is mainline.
33-
branch: mainline
33+
nginx_branch: mainline
3434

3535
# Location of your NGINX Plus license in your local machine.
3636
# Default is the files folder within the NGINX Ansible role.
37-
license:
37+
nginx_license:
3838
certificate: license/nginx-repo.crt
3939
key: license/nginx-repo.key
4040

4141
# Delete NGINX Plus license after installation for security purposes.
4242
# Default is true.
43-
delete_license: true
43+
nginx_delete_license: true
4444

4545
# Install NGINX JavaScript, Perl, ModSecurity WAF (NGINX Plus only), GeoIP, Image-Filter, RTMP Media Streaming, and/or XSLT modules.
4646
# Default is false.
47-
modules:
47+
nginx_modules:
4848
njs: false
4949
perl: false
5050
waf: false
@@ -57,55 +57,55 @@ modules:
5757
# Use your NGINX Amplify API key.
5858
# Requires access to either the NGINX stub status or the NGINX Plus REST API.
5959
# Default is null.
60-
amplify_enable: false
61-
amplify_api_key: null
60+
nginx_amplify_enable: false
61+
nginx_amplify_api_key: null
6262

6363
# Install NGINX Controller.
6464
# Use your NGINX Controller API key and NGINX Controller API endpoint.
6565
# Requires NGINX Plus and write access to the NGINX Plus REST API.
6666
# Default is null.
67-
controller_enable: false
68-
controller_api_key: null
69-
controller_api_endpoint: null
67+
nginx_controller_enable: false
68+
nginx_controller_api_key: null
69+
nginx_controller_api_endpoint: null
7070

7171
# Install NGINX Unit and NGINX Unit modules.
7272
# Use a list of supported NGINX Unit modules.
7373
# Default is false.
74-
unit_enable: false
75-
unit_modules: null
74+
nginx_unit_enable: false
75+
nginx_unit_modules: null
7676

7777
# Enable NGINX status data.
7878
# Will enable 'stub_status' in NGINX Open Source and 'status' in NGINX Plus.
7979
# Default is false.
80-
status_enable: false
80+
nginx_status_enable: false
8181

8282
# Enable NGINX Plus REST API, write access to the REST API, and NGINX Plus dashboard.
8383
# Requires NGINX Plus.
8484
# Default is false.
85-
rest_api_enable: false
86-
rest_api_write: false
87-
rest_api_dashboard: false
85+
nginx_rest_api_enable: false
86+
nginx_rest_api_write: false
87+
nginx_rest_api_dashboard: false
8888

8989
# Enable uploading NGINX configuration files to your system.
9090
# Default for uploading files is false.
9191
# Default location of files is the files folder within the NGINX Ansible role.
92-
main_push_enable: false
93-
main_push_location: conf/nginx.conf
94-
http_push_enable: false
95-
http_push_location: conf/http/*.conf
96-
stream_push_enable: false
97-
stream_push_location: conf/stream/*.conf
92+
nginx_main_push_enable: false
93+
nginx_main_push_location: conf/nginx.conf
94+
nginx_http_push_enable: false
95+
nginx_http_push_location: conf/http/*.conf
96+
nginx_stream_push_enable: false
97+
nginx_stream_push_location: conf/stream/*.conf
9898

9999
# Configuration variables to create a templated NGINX configuration.
100100
# Defaults are the values found in a fresh NGINX installation.
101-
main_template_enable: false
102-
main_template_user: nginx
103-
main_template_worker_processes: auto
104-
main_template_error_level: warn
105-
main_template_worker_connections: 1024
106-
http_template_enable: false
107-
http_template_keepalive_timeout: 65
108-
http_template_listen: 80
109-
http_template_server_name: localhost
110-
stream_template_enable: false
111-
stream_template_listen: 12345
101+
nginx_main_template_enable: false
102+
nginx_main_template_user: nginx
103+
nginx_main_template_worker_processes: auto
104+
nginx_main_template_error_level: warn
105+
nginx_main_template_worker_connections: 1024
106+
nginx_http_template_enable: false
107+
nginx_http_template_keepalive_timeout: 65
108+
nginx_http_template_listen: 80
109+
nginx_http_template_server_name: localhost
110+
nginx_stream_template_enable: false
111+
nginx_stream_template_listen: 12345

tasks/conf/push-config.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
---
22
- name: "(Setup: All NGINX) Upload NGINX Main Configuration File"
33
copy:
4-
src: "{{ main_push_location }}"
4+
src: "{{ nginx_main_push_location }}"
55
dest: /etc/nginx/nginx.conf
66
backup: yes
77
notify: "(Handler: All OSs) Reload NGINX"
8-
when: main_push_enable
8+
when: nginx_main_push_enable
99

1010
- name: "(Setup: All NGINX) Ensure NGINX HTTP Directory Exists"
1111
file:
1212
path: /etc/nginx/conf.d/http
1313
state: directory
14-
when: http_push_enable
14+
when: nginx_http_push_enable
1515

1616
- name: "(Setup: All NGINX) Upload NGINX HTTP Configuration Files"
1717
copy:
1818
src: "{{ item }}"
1919
dest: /etc/nginx/conf.d/http
2020
backup: yes
2121
with_fileglob:
22-
- "{{ http_push_location }}"
22+
- "{{ nginx_http_push_location }}"
2323
notify: "(Handler: All OSs) Reload NGINX"
24-
when: http_push_enable
24+
when: nginx_http_push_enable
2525

2626
- name: "(Setup: All NGINX) Ensure NGINX Stream Directory Exists"
2727
file:
2828
path: /etc/nginx/conf.d/stream
2929
state: directory
30-
when: stream_push_enable
30+
when: nginx_stream_push_enable
3131

3232
- name: "(Setup: All NGINX) Upload NGINX Stream Configuration Files"
3333
copy:
3434
src: "{{ item }}"
3535
dest: /etc/nginx/conf.d/stream
3636
backup: yes
3737
with_fileglob:
38-
- "{{ stream_push_location }}"
38+
- "{{ nginx_stream_push_location }}"
3939
notify: "(Handler: All OSs) Reload NGINX"
40-
when: stream_push_enable
40+
when: nginx_stream_push_enable

tasks/conf/setup-rest-api.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
---
22
- name: "(Setup: NGINX Plus) Setup NGINX Plus API"
33
blockinfile:
4-
path: "{{ (http_template_enable) | ternary('/etc/nginx/conf.d/http/api.conf','/etc/nginx/conf.d/api.conf') }}"
4+
path: "{{ (nginx_http_template_enable) | ternary('/etc/nginx/conf.d/http/api.conf','/etc/nginx/conf.d/api.conf') }}"
55
create: yes
66
block: |
77
server {
88
listen 8080;
99
location /api {
10-
{% if rest_api_write %}
10+
{% if nginx_rest_api_write %}
1111
api write=on;
1212
{% else %}
1313
api;
1414
{% endif %}
1515
}
16-
{% if rest_api_dashboard %}
16+
{% if nginx_rest_api_dashboard %}
1717
location = /dashboard.html {
1818
root /usr/share/nginx/html;
1919
}

0 commit comments

Comments
 (0)