commit
44a74aad75
88
README.md
88
README.md
@ -173,13 +173,13 @@ nginx_enable: true
|
|||||||
# Specify which version of NGINX you want to install.
|
# Specify which version of NGINX you want to install.
|
||||||
# Options are 'opensource' or 'plus'.
|
# Options are 'opensource' or 'plus'.
|
||||||
# Default is 'opensource'.
|
# Default is 'opensource'.
|
||||||
type: opensource
|
nginx_type: opensource
|
||||||
|
|
||||||
# Specify repository origin for NGINX Open Source.
|
# Specify repository origin for NGINX Open Source.
|
||||||
# Options are 'nginx_repository' or 'os_repository'.
|
# Options are 'nginx_repository' or 'os_repository'.
|
||||||
# Only works if 'type' is set to 'opensource'.
|
# Only works if 'nginx_type' is set to 'opensource'.
|
||||||
# Default is nginx_repository.
|
# Default is nginx_repository.
|
||||||
install_from: nginx_repository
|
nginx_install_from: nginx_repository
|
||||||
|
|
||||||
# Specify source repository for NGINX Open Source.
|
# Specify source repository for NGINX Open Source.
|
||||||
# Only works if 'install_from' is set to 'nginx_repository'.
|
# Only works if 'install_from' is set to 'nginx_repository'.
|
||||||
@ -197,21 +197,21 @@ nginx_repository:
|
|||||||
# Options are 'mainline' or 'stable'.
|
# Options are 'mainline' or 'stable'.
|
||||||
# Only works if 'install_from' is set to 'nginx_repository'.
|
# Only works if 'install_from' is set to 'nginx_repository'.
|
||||||
# Default is mainline.
|
# Default is mainline.
|
||||||
branch: mainline
|
nginx_branch: mainline
|
||||||
|
|
||||||
# Location of your NGINX Plus license in your local machine.
|
# Location of your NGINX Plus license in your local machine.
|
||||||
# Default is the files folder within the NGINX Ansible role.
|
# Default is the files folder within the NGINX Ansible role.
|
||||||
license:
|
nginx_license:
|
||||||
certificate: license/nginx-repo.crt
|
certificate: license/nginx-repo.crt
|
||||||
key: license/nginx-repo.key
|
key: license/nginx-repo.key
|
||||||
|
|
||||||
# Delete NGINX Plus license after installation for security purposes.
|
# Delete NGINX Plus license after installation for security purposes.
|
||||||
# Default is true.
|
# Default is true.
|
||||||
delete_license: true
|
nginx_delete_license: true
|
||||||
|
|
||||||
# Install NGINX JavaScript, Perl, ModSecurity WAF (NGINX Plus only), GeoIP, Image-Filter, RTMP Media Streaming, and/or XSLT modules.
|
# Install NGINX JavaScript, Perl, ModSecurity WAF (NGINX Plus only), GeoIP, Image-Filter, RTMP Media Streaming, and/or XSLT modules.
|
||||||
# Default is false.
|
# Default is false.
|
||||||
modules:
|
nginx_modules:
|
||||||
njs: false
|
njs: false
|
||||||
perl: false
|
perl: false
|
||||||
waf: false
|
waf: false
|
||||||
@ -224,58 +224,58 @@ modules:
|
|||||||
# Use your NGINX Amplify API key.
|
# Use your NGINX Amplify API key.
|
||||||
# Requires access to either the NGINX stub status or the NGINX Plus REST API.
|
# Requires access to either the NGINX stub status or the NGINX Plus REST API.
|
||||||
# Default is null.
|
# Default is null.
|
||||||
amplify_enable: false
|
nginx_amplify_enable: false
|
||||||
amplify_api_key: null
|
nginx_amplify_api_key: null
|
||||||
|
|
||||||
# Install NGINX Controller.
|
# Install NGINX Controller.
|
||||||
# Use your NGINX Controller API key and NGINX Controller API endpoint.
|
# Use your NGINX Controller API key and NGINX Controller API endpoint.
|
||||||
# Requires NGINX Plus and write access to the NGINX Plus REST API.
|
# Requires NGINX Plus and write access to the NGINX Plus REST API.
|
||||||
# Default is null.
|
# Default is null.
|
||||||
controller_enable: false
|
nginx_controller_enable: false
|
||||||
controller_api_key: null
|
nginx_controller_api_key: null
|
||||||
controller_api_endpoint: null
|
nginx_controller_api_endpoint: null
|
||||||
|
|
||||||
# Install NGINX Unit and NGINX Unit modules.
|
# Install NGINX Unit and NGINX Unit modules.
|
||||||
# Use a list of supported NGINX Unit modules.
|
# Use a list of supported NGINX Unit modules.
|
||||||
# Default is false.
|
# Default is false.
|
||||||
unit_enable: false
|
nginx_unit_enable: false
|
||||||
unit_modules: null
|
nginx_unit_modules: null
|
||||||
|
|
||||||
# Enable NGINX status data.
|
# Enable NGINX status data.
|
||||||
# Will enable 'stub_status' in NGINX Open Source and 'status' in NGINX Plus.
|
# Will enable 'stub_status' in NGINX Open Source and 'status' in NGINX Plus.
|
||||||
# Default is false.
|
# Default is false.
|
||||||
status_enable: false
|
nginx_status_enable: false
|
||||||
|
|
||||||
# Enable NGINX Plus REST API, write access to the REST API, and NGINX Plus dashboard.
|
# Enable NGINX Plus REST API, write access to the REST API, and NGINX Plus dashboard.
|
||||||
# Requires NGINX Plus.
|
# Requires NGINX Plus.
|
||||||
# Default is false.
|
# Default is false.
|
||||||
rest_api_enable: false
|
nginx_rest_api_enable: false
|
||||||
rest_api_write: false
|
nginx_rest_api_write: false
|
||||||
rest_api_dashboard: false
|
nginx_rest_api_dashboard: false
|
||||||
|
|
||||||
# Enable uploading NGINX configuration files to your system.
|
# Enable uploading NGINX configuration files to your system.
|
||||||
# Default for uploading files is false.
|
# Default for uploading files is false.
|
||||||
# Default location of files is the files folder within the NGINX Ansible role.
|
# Default location of files is the files folder within the NGINX Ansible role.
|
||||||
main_push_enable: false
|
nginx_main_push_enable: false
|
||||||
main_push_location: conf/nginx.conf
|
nginx_main_push_location: conf/nginx.conf
|
||||||
http_push_enable: false
|
nginx_http_push_enable: false
|
||||||
http_push_location: conf/http/*.conf
|
nginx_http_push_location: conf/http/*.conf
|
||||||
stream_push_enable: false
|
nginx_stream_push_enable: false
|
||||||
stream_push_location: conf/stream/*.conf
|
nginx_stream_push_location: conf/stream/*.conf
|
||||||
|
|
||||||
# Configuration variables to create a templated NGINX configuration.
|
# Configuration variables to create a templated NGINX configuration.
|
||||||
# Defaults are the values found in a fresh NGINX installation.
|
# Defaults are the values found in a fresh NGINX installation.
|
||||||
main_template_enable: false
|
nginx_main_template_enable: false
|
||||||
main_template_user: nginx
|
nginx_main_template_user: nginx
|
||||||
main_template_worker_processes: auto
|
nginx_main_template_worker_processes: auto
|
||||||
main_template_error_level: warn
|
nginx_main_template_error_level: warn
|
||||||
main_template_worker_connections: 1024
|
nginx_main_template_worker_connections: 1024
|
||||||
http_template_enable: false
|
nginx_http_template_enable: false
|
||||||
http_template_keepalive_timeout: 65
|
nginx_http_template_keepalive_timeout: 65
|
||||||
http_template_listen: 80
|
nginx_http_template_listen: 80
|
||||||
http_template_server_name: localhost
|
nginx_http_template_server_name: localhost
|
||||||
stream_template_enable: false
|
nginx_stream_template_enable: false
|
||||||
stream_template_listen: 12345
|
nginx_stream_template_listen: 12345
|
||||||
```
|
```
|
||||||
|
|
||||||
Dependencies
|
Dependencies
|
||||||
@ -315,7 +315,7 @@ This is a sample playbook file for deploying the Ansible Galaxy NGINX role in a
|
|||||||
roles:
|
roles:
|
||||||
- role: nginxinc.nginx
|
- role: nginxinc.nginx
|
||||||
vars:
|
vars:
|
||||||
type: plus
|
nginx_type: plus
|
||||||
```
|
```
|
||||||
|
|
||||||
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.
|
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
|
|||||||
roles:
|
roles:
|
||||||
- role: nginxinc.nginx
|
- role: nginxinc.nginx
|
||||||
vars:
|
vars:
|
||||||
type: plus
|
nginx_type: plus
|
||||||
rest_api_enable: true
|
nginx_rest_api_enable: true
|
||||||
rest_api_write: true
|
nginx_rest_api_write: true
|
||||||
controller_enable: true
|
nginx_controller_enable: true
|
||||||
controller_api_key: <API_KEY_HERE>
|
nginx_controller_api_key: <API_KEY_HERE>
|
||||||
controller_api_endpoint: https://<FQDN>/1.4
|
nginx_controller_api_endpoint: https://<FQDN>/1.4
|
||||||
```
|
```
|
||||||
|
|
||||||
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.
|
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
|
|||||||
- role: nginxinc.nginx
|
- role: nginxinc.nginx
|
||||||
vars:
|
vars:
|
||||||
nginx_enable: false
|
nginx_enable: false
|
||||||
unit_enable: true
|
nginx_unit_enable: true
|
||||||
unit_modules:
|
nginx_unit_modules:
|
||||||
- unit-php
|
- unit-php
|
||||||
- unit-perl
|
- unit-perl
|
||||||
```
|
```
|
||||||
|
@ -6,45 +6,45 @@ nginx_enable: true
|
|||||||
# Specify which version of NGINX you want to install.
|
# Specify which version of NGINX you want to install.
|
||||||
# Options are 'opensource' or 'plus'.
|
# Options are 'opensource' or 'plus'.
|
||||||
# Default is 'opensource'.
|
# Default is 'opensource'.
|
||||||
type: opensource
|
nginx_type: opensource
|
||||||
|
|
||||||
# Specify repository origin for NGINX Open Source.
|
# Specify repository origin for NGINX Open Source.
|
||||||
# Options are 'nginx_repository' or 'os_repository'.
|
# Options are 'nginx_repository' or 'os_repository'.
|
||||||
# Only works if 'type' is set to 'opensource'.
|
# Only works if 'nginx_type' is set to 'opensource'.
|
||||||
# Default is nginx_repository.
|
# Default is nginx_repository.
|
||||||
install_from: nginx_repository
|
nginx_install_from: nginx_repository
|
||||||
|
|
||||||
# Specify source repository for NGINX Open Source.
|
# Specify source repository for NGINX Open Source.
|
||||||
# Only works if 'install_from' is set to 'nginx_repository'.
|
# Only works if 'install_from' is set to 'nginx_repository'.
|
||||||
# Defaults are the official NGINX repositories.
|
# Defaults are the official NGINX repositories.
|
||||||
nginx_repository:
|
nginx_repository:
|
||||||
debian:
|
debian:
|
||||||
- deb https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/', '') }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
|
- deb https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
|
||||||
- deb-src https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/', '') }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
|
- deb-src https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
|
||||||
redhat:
|
redhat:
|
||||||
- https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/', '') }}{{ (ansible_distribution == "RedHat") | ternary('rhel/', 'centos/') }}{{ ansible_distribution_major_version|int }}/$basearch/
|
- https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}{{ (ansible_distribution == "RedHat") | ternary('rhel/', 'centos/') }}{{ ansible_distribution_major_version|int }}/$basearch/
|
||||||
suse:
|
suse:
|
||||||
- https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/', '') }}sles/12
|
- https://nginx.org/packages/{{ (nginx_branch == 'mainline') | ternary('mainline/', '') }}sles/12
|
||||||
|
|
||||||
# Specify which branch of NGINX Open Source you want to install.
|
# Specify which branch of NGINX Open Source you want to install.
|
||||||
# Options are 'mainline' or 'stable'.
|
# Options are 'mainline' or 'stable'.
|
||||||
# Only works if 'install_from' is set to 'nginx_repository'.
|
# Only works if 'install_from' is set to 'nginx_repository'.
|
||||||
# Default is mainline.
|
# Default is mainline.
|
||||||
branch: mainline
|
nginx_branch: mainline
|
||||||
|
|
||||||
# Location of your NGINX Plus license in your local machine.
|
# Location of your NGINX Plus license in your local machine.
|
||||||
# Default is the files folder within the NGINX Ansible role.
|
# Default is the files folder within the NGINX Ansible role.
|
||||||
license:
|
nginx_license:
|
||||||
certificate: license/nginx-repo.crt
|
certificate: license/nginx-repo.crt
|
||||||
key: license/nginx-repo.key
|
key: license/nginx-repo.key
|
||||||
|
|
||||||
# Delete NGINX Plus license after installation for security purposes.
|
# Delete NGINX Plus license after installation for security purposes.
|
||||||
# Default is true.
|
# Default is true.
|
||||||
delete_license: true
|
nginx_delete_license: true
|
||||||
|
|
||||||
# Install NGINX JavaScript, Perl, ModSecurity WAF (NGINX Plus only), GeoIP, Image-Filter, RTMP Media Streaming, and/or XSLT modules.
|
# Install NGINX JavaScript, Perl, ModSecurity WAF (NGINX Plus only), GeoIP, Image-Filter, RTMP Media Streaming, and/or XSLT modules.
|
||||||
# Default is false.
|
# Default is false.
|
||||||
modules:
|
nginx_modules:
|
||||||
njs: false
|
njs: false
|
||||||
perl: false
|
perl: false
|
||||||
waf: false
|
waf: false
|
||||||
@ -57,55 +57,55 @@ modules:
|
|||||||
# Use your NGINX Amplify API key.
|
# Use your NGINX Amplify API key.
|
||||||
# Requires access to either the NGINX stub status or the NGINX Plus REST API.
|
# Requires access to either the NGINX stub status or the NGINX Plus REST API.
|
||||||
# Default is null.
|
# Default is null.
|
||||||
amplify_enable: false
|
nginx_amplify_enable: false
|
||||||
amplify_api_key: null
|
nginx_amplify_api_key: null
|
||||||
|
|
||||||
# Install NGINX Controller.
|
# Install NGINX Controller.
|
||||||
# Use your NGINX Controller API key and NGINX Controller API endpoint.
|
# Use your NGINX Controller API key and NGINX Controller API endpoint.
|
||||||
# Requires NGINX Plus and write access to the NGINX Plus REST API.
|
# Requires NGINX Plus and write access to the NGINX Plus REST API.
|
||||||
# Default is null.
|
# Default is null.
|
||||||
controller_enable: false
|
nginx_controller_enable: false
|
||||||
controller_api_key: null
|
nginx_controller_api_key: null
|
||||||
controller_api_endpoint: null
|
nginx_controller_api_endpoint: null
|
||||||
|
|
||||||
# Install NGINX Unit and NGINX Unit modules.
|
# Install NGINX Unit and NGINX Unit modules.
|
||||||
# Use a list of supported NGINX Unit modules.
|
# Use a list of supported NGINX Unit modules.
|
||||||
# Default is false.
|
# Default is false.
|
||||||
unit_enable: false
|
nginx_unit_enable: false
|
||||||
unit_modules: null
|
nginx_unit_modules: null
|
||||||
|
|
||||||
# Enable NGINX status data.
|
# Enable NGINX status data.
|
||||||
# Will enable 'stub_status' in NGINX Open Source and 'status' in NGINX Plus.
|
# Will enable 'stub_status' in NGINX Open Source and 'status' in NGINX Plus.
|
||||||
# Default is false.
|
# Default is false.
|
||||||
status_enable: false
|
nginx_status_enable: false
|
||||||
|
|
||||||
# Enable NGINX Plus REST API, write access to the REST API, and NGINX Plus dashboard.
|
# Enable NGINX Plus REST API, write access to the REST API, and NGINX Plus dashboard.
|
||||||
# Requires NGINX Plus.
|
# Requires NGINX Plus.
|
||||||
# Default is false.
|
# Default is false.
|
||||||
rest_api_enable: false
|
nginx_rest_api_enable: false
|
||||||
rest_api_write: false
|
nginx_rest_api_write: false
|
||||||
rest_api_dashboard: false
|
nginx_rest_api_dashboard: false
|
||||||
|
|
||||||
# Enable uploading NGINX configuration files to your system.
|
# Enable uploading NGINX configuration files to your system.
|
||||||
# Default for uploading files is false.
|
# Default for uploading files is false.
|
||||||
# Default location of files is the files folder within the NGINX Ansible role.
|
# Default location of files is the files folder within the NGINX Ansible role.
|
||||||
main_push_enable: false
|
nginx_main_push_enable: false
|
||||||
main_push_location: conf/nginx.conf
|
nginx_main_push_location: conf/nginx.conf
|
||||||
http_push_enable: false
|
nginx_http_push_enable: false
|
||||||
http_push_location: conf/http/*.conf
|
nginx_http_push_location: conf/http/*.conf
|
||||||
stream_push_enable: false
|
nginx_stream_push_enable: false
|
||||||
stream_push_location: conf/stream/*.conf
|
nginx_stream_push_location: conf/stream/*.conf
|
||||||
|
|
||||||
# Configuration variables to create a templated NGINX configuration.
|
# Configuration variables to create a templated NGINX configuration.
|
||||||
# Defaults are the values found in a fresh NGINX installation.
|
# Defaults are the values found in a fresh NGINX installation.
|
||||||
main_template_enable: false
|
nginx_main_template_enable: false
|
||||||
main_template_user: nginx
|
nginx_main_template_user: nginx
|
||||||
main_template_worker_processes: auto
|
nginx_main_template_worker_processes: auto
|
||||||
main_template_error_level: warn
|
nginx_main_template_error_level: warn
|
||||||
main_template_worker_connections: 1024
|
nginx_main_template_worker_connections: 1024
|
||||||
http_template_enable: false
|
nginx_http_template_enable: false
|
||||||
http_template_keepalive_timeout: 65
|
nginx_http_template_keepalive_timeout: 65
|
||||||
http_template_listen: 80
|
nginx_http_template_listen: 80
|
||||||
http_template_server_name: localhost
|
nginx_http_template_server_name: localhost
|
||||||
stream_template_enable: false
|
nginx_stream_template_enable: false
|
||||||
stream_template_listen: 12345
|
nginx_stream_template_listen: 12345
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
---
|
---
|
||||||
- name: "(Setup: All NGINX) Upload NGINX Main Configuration File"
|
- name: "(Setup: All NGINX) Upload NGINX Main Configuration File"
|
||||||
copy:
|
copy:
|
||||||
src: "{{ main_push_location }}"
|
src: "{{ nginx_main_push_location }}"
|
||||||
dest: /etc/nginx/nginx.conf
|
dest: /etc/nginx/nginx.conf
|
||||||
backup: yes
|
backup: yes
|
||||||
notify: "(Handler: All OSs) Reload NGINX"
|
notify: "(Handler: All OSs) Reload NGINX"
|
||||||
when: main_push_enable
|
when: nginx_main_push_enable
|
||||||
|
|
||||||
- name: "(Setup: All NGINX) Ensure NGINX HTTP Directory Exists"
|
- name: "(Setup: All NGINX) Ensure NGINX HTTP Directory Exists"
|
||||||
file:
|
file:
|
||||||
path: /etc/nginx/conf.d/http
|
path: /etc/nginx/conf.d/http
|
||||||
state: directory
|
state: directory
|
||||||
when: http_push_enable
|
when: nginx_http_push_enable
|
||||||
|
|
||||||
- name: "(Setup: All NGINX) Upload NGINX HTTP Configuration Files"
|
- name: "(Setup: All NGINX) Upload NGINX HTTP Configuration Files"
|
||||||
copy:
|
copy:
|
||||||
@ -19,15 +19,15 @@
|
|||||||
dest: /etc/nginx/conf.d/http
|
dest: /etc/nginx/conf.d/http
|
||||||
backup: yes
|
backup: yes
|
||||||
with_fileglob:
|
with_fileglob:
|
||||||
- "{{ http_push_location }}"
|
- "{{ nginx_http_push_location }}"
|
||||||
notify: "(Handler: All OSs) Reload NGINX"
|
notify: "(Handler: All OSs) Reload NGINX"
|
||||||
when: http_push_enable
|
when: nginx_http_push_enable
|
||||||
|
|
||||||
- name: "(Setup: All NGINX) Ensure NGINX Stream Directory Exists"
|
- name: "(Setup: All NGINX) Ensure NGINX Stream Directory Exists"
|
||||||
file:
|
file:
|
||||||
path: /etc/nginx/conf.d/stream
|
path: /etc/nginx/conf.d/stream
|
||||||
state: directory
|
state: directory
|
||||||
when: stream_push_enable
|
when: nginx_stream_push_enable
|
||||||
|
|
||||||
- name: "(Setup: All NGINX) Upload NGINX Stream Configuration Files"
|
- name: "(Setup: All NGINX) Upload NGINX Stream Configuration Files"
|
||||||
copy:
|
copy:
|
||||||
@ -35,6 +35,6 @@
|
|||||||
dest: /etc/nginx/conf.d/stream
|
dest: /etc/nginx/conf.d/stream
|
||||||
backup: yes
|
backup: yes
|
||||||
with_fileglob:
|
with_fileglob:
|
||||||
- "{{ stream_push_location }}"
|
- "{{ nginx_stream_push_location }}"
|
||||||
notify: "(Handler: All OSs) Reload NGINX"
|
notify: "(Handler: All OSs) Reload NGINX"
|
||||||
when: stream_push_enable
|
when: nginx_stream_push_enable
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
---
|
---
|
||||||
- name: "(Setup: NGINX Plus) Setup NGINX Plus API"
|
- name: "(Setup: NGINX Plus) Setup NGINX Plus API"
|
||||||
blockinfile:
|
blockinfile:
|
||||||
path: "{{ (http_template_enable) | ternary('/etc/nginx/conf.d/http/api.conf','/etc/nginx/conf.d/api.conf') }}"
|
path: "{{ (nginx_http_template_enable) | ternary('/etc/nginx/conf.d/http/api.conf','/etc/nginx/conf.d/api.conf') }}"
|
||||||
create: yes
|
create: yes
|
||||||
block: |
|
block: |
|
||||||
server {
|
server {
|
||||||
listen 8080;
|
listen 8080;
|
||||||
location /api {
|
location /api {
|
||||||
{% if rest_api_write %}
|
{% if nginx_rest_api_write %}
|
||||||
api write=on;
|
api write=on;
|
||||||
{% else %}
|
{% else %}
|
||||||
api;
|
api;
|
||||||
{% endif %}
|
{% endif %}
|
||||||
}
|
}
|
||||||
{% if rest_api_dashboard %}
|
{% if nginx_rest_api_dashboard %}
|
||||||
location = /dashboard.html {
|
location = /dashboard.html {
|
||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: "(Setup: NGINX Open Source) Enable NGINX Open Source Status"
|
- name: "(Setup: NGINX Open Source) Enable NGINX Open Source Status"
|
||||||
blockinfile:
|
blockinfile:
|
||||||
path: "{{ (http_template_enable) | ternary('/etc/nginx/conf.d/http/stub_status.conf','/etc/nginx/conf.d/stub_status.conf') }}"
|
path: "{{ (nginx_http_template_enable) | ternary('/etc/nginx/conf.d/http/stub_status.conf','/etc/nginx/conf.d/stub_status.conf') }}"
|
||||||
create: yes
|
create: yes
|
||||||
block: |
|
block: |
|
||||||
server {
|
server {
|
||||||
@ -12,12 +12,12 @@
|
|||||||
deny all;
|
deny all;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
when: type == "opensource"
|
when: nginx_type == "opensource"
|
||||||
notify: "(Handler: All OSs) Reload NGINX"
|
notify: "(Handler: All OSs) Reload NGINX"
|
||||||
|
|
||||||
- name: "(Setup: NGINX Plus) Enable NGINX Plus Status"
|
- name: "(Setup: NGINX Plus) Enable NGINX Plus Status"
|
||||||
blockinfile:
|
blockinfile:
|
||||||
path: "{{ (http_template_enable) | ternary('/etc/nginx/conf.d/http/status.conf','/etc/nginx/conf.d/status.conf') }}"
|
path: "{{ (nginx_http_template_enable) | ternary('/etc/nginx/conf.d/http/status.conf','/etc/nginx/conf.d/status.conf') }}"
|
||||||
create: yes
|
create: yes
|
||||||
block: |
|
block: |
|
||||||
server {
|
server {
|
||||||
@ -28,5 +28,5 @@
|
|||||||
deny all;
|
deny all;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
when: type == "plus"
|
when: nginx_type == "plus"
|
||||||
notify: "(Handler: All OSs) Reload NGINX"
|
notify: "(Handler: All OSs) Reload NGINX"
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
src: nginx.conf.j2
|
src: nginx.conf.j2
|
||||||
dest: /etc/nginx/nginx.conf
|
dest: /etc/nginx/nginx.conf
|
||||||
backup: yes
|
backup: yes
|
||||||
when: main_template_enable
|
when: nginx_main_template_enable
|
||||||
notify: "(Handler: All OSs) Reload NGINX"
|
notify: "(Handler: All OSs) Reload NGINX"
|
||||||
|
|
||||||
- name: "(Setup: All NGINX) Ensure NGINX HTTP Directory Exists"
|
- name: "(Setup: All NGINX) Ensure NGINX HTTP Directory Exists"
|
||||||
file:
|
file:
|
||||||
path: /etc/nginx/conf.d/http
|
path: /etc/nginx/conf.d/http
|
||||||
state: directory
|
state: directory
|
||||||
when: http_template_enable
|
when: nginx_http_template_enable
|
||||||
|
|
||||||
- name: "(Setup: All NGINX) Dynamically Generate NGINX HTTP Configuration Files"
|
- name: "(Setup: All NGINX) Dynamically Generate NGINX HTTP Configuration Files"
|
||||||
template:
|
template:
|
||||||
@ -20,14 +20,14 @@
|
|||||||
backup: yes
|
backup: yes
|
||||||
with_fileglob:
|
with_fileglob:
|
||||||
- "../templates/http/*.j2"
|
- "../templates/http/*.j2"
|
||||||
when: http_template_enable
|
when: nginx_http_template_enable
|
||||||
notify: "(Handler: All OSs) Reload NGINX"
|
notify: "(Handler: All OSs) Reload NGINX"
|
||||||
|
|
||||||
- name: "(Setup: All NGINX) Ensure NGINX Stream Directory Exists"
|
- name: "(Setup: All NGINX) Ensure NGINX Stream Directory Exists"
|
||||||
file:
|
file:
|
||||||
path: /etc/nginx/conf.d/stream
|
path: /etc/nginx/conf.d/stream
|
||||||
state: directory
|
state: directory
|
||||||
when: stream_template_enable
|
when: nginx_stream_template_enable
|
||||||
|
|
||||||
- name: "(Setup: All NGINX) Dynamically Generate NGINX Stream Configuration Files"
|
- name: "(Setup: All NGINX) Dynamically Generate NGINX Stream Configuration Files"
|
||||||
template:
|
template:
|
||||||
@ -36,5 +36,5 @@
|
|||||||
backup: yes
|
backup: yes
|
||||||
with_fileglob:
|
with_fileglob:
|
||||||
- "../templates/stream/*.j2"
|
- "../templates/stream/*.j2"
|
||||||
when: stream_template_enable
|
when: nginx_stream_template_enable
|
||||||
notify: "(Handler: All OSs) Reload NGINX"
|
notify: "(Handler: All OSs) Reload NGINX"
|
||||||
|
@ -26,13 +26,13 @@
|
|||||||
lineinfile:
|
lineinfile:
|
||||||
dest: /etc/controller-agent/agent.conf
|
dest: /etc/controller-agent/agent.conf
|
||||||
regexp: api_key =.*
|
regexp: api_key =.*
|
||||||
line: "api_key = {{ controller_api_key }}"
|
line: "api_key = {{ nginx_controller_api_key }}"
|
||||||
|
|
||||||
- name: "(Setup: All OSs) Configure NGINX Controller Agent API URL"
|
- name: "(Setup: All OSs) Configure NGINX Controller Agent API URL"
|
||||||
lineinfile:
|
lineinfile:
|
||||||
dest: /etc/controller-agent/agent.conf
|
dest: /etc/controller-agent/agent.conf
|
||||||
regexp: api_url =.*
|
regexp: api_url =.*
|
||||||
line: "api_url = {{ controller_api_endpoint }}"
|
line: "api_url = {{ nginx_controller_api_endpoint }}"
|
||||||
|
|
||||||
- name: "(Setup: All OSs) Configure NGINX Controller Agent API Hostname"
|
- name: "(Setup: All OSs) Configure NGINX Controller Agent API Hostname"
|
||||||
lineinfile:
|
lineinfile:
|
||||||
|
@ -11,33 +11,33 @@
|
|||||||
block:
|
block:
|
||||||
|
|
||||||
- import_tasks: opensource/install-oss.yml
|
- import_tasks: opensource/install-oss.yml
|
||||||
when: type == "opensource"
|
when: nginx_type == "opensource"
|
||||||
|
|
||||||
- import_tasks: plus/install-plus.yml
|
- import_tasks: plus/install-plus.yml
|
||||||
when: type == "plus"
|
when: nginx_type == "plus"
|
||||||
|
|
||||||
- import_tasks: modules/install-modules.yml
|
- import_tasks: modules/install-modules.yml
|
||||||
when: true in modules.values()
|
when: true in nginx_modules.values()
|
||||||
|
|
||||||
- import_tasks: conf/push-config.yml
|
- import_tasks: conf/push-config.yml
|
||||||
when: main_push_enable or http_push_enable or stream_push_enable
|
when: nginx_main_push_enable or nginx_http_push_enable or nginx_stream_push_enable
|
||||||
|
|
||||||
- import_tasks: conf/template-config.yml
|
- import_tasks: conf/template-config.yml
|
||||||
when: main_template_enable or http_template_enable or stream_template_enable
|
when: nginx_main_template_enable or nginx_http_template_enable or nginx_stream_template_enable
|
||||||
|
|
||||||
- import_tasks: conf/setup-status.yml
|
- import_tasks: conf/setup-status.yml
|
||||||
when: status_enable
|
when: nginx_status_enable
|
||||||
|
|
||||||
- import_tasks: conf/setup-rest-api.yml
|
- import_tasks: conf/setup-rest-api.yml
|
||||||
when: rest_api_enable and type == "plus"
|
when: nginx_rest_api_enable and nginx_type == "plus"
|
||||||
|
|
||||||
when: nginx_enable
|
when: nginx_enable
|
||||||
|
|
||||||
- import_tasks: amplify/install-amplify.yml
|
- import_tasks: amplify/install-amplify.yml
|
||||||
when: amplify_enable and amplify_api_key is defined and amplify_api_key
|
when: nginx_amplify_enable and nginx_amplify_api_key is defined and nginx_amplify_api_key
|
||||||
|
|
||||||
- import_tasks: controller/install-controller.yml
|
- import_tasks: controller/install-controller.yml
|
||||||
when: controller_enable and controller_api_key is defined and controller_api_key and controller_api_endpoint is defined and controller_api_endpoint
|
when: nginx_controller_enable and nginx_controller_api_key is defined and nginx_controller_api_key and nginx_controller_api_endpoint is defined and nginx_controller_api_endpoint
|
||||||
|
|
||||||
- import_tasks: unit/install-unit.yml
|
- import_tasks: unit/install-unit.yml
|
||||||
when: unit_enable
|
when: nginx_unit_enable
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
package:
|
package:
|
||||||
name: nginx-module-geoip
|
name: nginx-module-geoip
|
||||||
state: present
|
state: present
|
||||||
when: type == "opensource"
|
when: nginx_type == "opensource"
|
||||||
|
|
||||||
- name: "(Install: All OSs) Install NGINX Plus GeoIP Module"
|
- name: "(Install: All OSs) Install NGINX Plus GeoIP Module"
|
||||||
package:
|
package:
|
||||||
name: nginx-plus-module-geoip
|
name: nginx-plus-module-geoip
|
||||||
state: present
|
state: present
|
||||||
when: type == "plus"
|
when: nginx_type == "plus"
|
||||||
|
|
||||||
- name: "(Setup: All NGINX) Load NGINX GeoIP Module"
|
- name: "(Setup: All NGINX) Load NGINX GeoIP Module"
|
||||||
blockinfile:
|
blockinfile:
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
package:
|
package:
|
||||||
name: nginx-module-image-filter
|
name: nginx-module-image-filter
|
||||||
state: present
|
state: present
|
||||||
when: type == "opensource"
|
when: nginx_type == "opensource"
|
||||||
|
|
||||||
- name: "(Install: All OSs) Install NGINX Plus Image Filter Module"
|
- name: "(Install: All OSs) Install NGINX Plus Image Filter Module"
|
||||||
package:
|
package:
|
||||||
name: nginx-plus-module-image-filter
|
name: nginx-plus-module-image-filter
|
||||||
state: present
|
state: present
|
||||||
when: type == "plus"
|
when: nginx_type == "plus"
|
||||||
|
|
||||||
- name: "(Setup: All NGINX) Load NGINX Image Filter Module"
|
- name: "(Setup: All NGINX) Load NGINX Image Filter Module"
|
||||||
lineinfile:
|
lineinfile:
|
||||||
|
@ -18,4 +18,4 @@
|
|||||||
when: modules.xslt | default(false)
|
when: modules.xslt | default(false)
|
||||||
|
|
||||||
- import_tasks: install-waf.yml
|
- import_tasks: install-waf.yml
|
||||||
when: modules.waf | default(false) and type == "plus"
|
when: modules.waf | default(false) and nginx_type == "plus"
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
package:
|
package:
|
||||||
name: nginx-module-njs
|
name: nginx-module-njs
|
||||||
state: present
|
state: present
|
||||||
when: type == "opensource"
|
when: nginx_type == "opensource"
|
||||||
|
|
||||||
- name: "(Install: All OSs) Install NGINX Plus JavaScript Module"
|
- name: "(Install: All OSs) Install NGINX Plus JavaScript Module"
|
||||||
package:
|
package:
|
||||||
name: nginx-plus-module-njs
|
name: nginx-plus-module-njs
|
||||||
state: present
|
state: present
|
||||||
when: type == "plus"
|
when: nginx_type == "plus"
|
||||||
|
|
||||||
- name: "(Setup: All NGINX) Load NGINX JavaScript Module"
|
- name: "(Setup: All NGINX) Load NGINX JavaScript Module"
|
||||||
blockinfile:
|
blockinfile:
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
package:
|
package:
|
||||||
name: nginx-module-perl
|
name: nginx-module-perl
|
||||||
state: present
|
state: present
|
||||||
when: type == "opensource"
|
when: nginx_type == "opensource"
|
||||||
|
|
||||||
- name: "(Install: All OSs) Install NGINX Plus Perl Module"
|
- name: "(Install: All OSs) Install NGINX Plus Perl Module"
|
||||||
package:
|
package:
|
||||||
name: nginx-plus-module-perl
|
name: nginx-plus-module-perl
|
||||||
state: present
|
state: present
|
||||||
when: type == "plus"
|
when: nginx_type == "plus"
|
||||||
|
|
||||||
- name: "(Setup: All NGINX) Load NGINX Perl Module"
|
- name: "(Setup: All NGINX) Load NGINX Perl Module"
|
||||||
lineinfile:
|
lineinfile:
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
package:
|
package:
|
||||||
name: nginx-module-rtmp
|
name: nginx-module-rtmp
|
||||||
state: present
|
state: present
|
||||||
when: type == "opensource"
|
when: nginx_type == "opensource"
|
||||||
|
|
||||||
- name: "(Install: All OSs) Install NGINX Plus RTMP Module"
|
- name: "(Install: All OSs) Install NGINX Plus RTMP Module"
|
||||||
package:
|
package:
|
||||||
name: nginx-plus-module-rtmp
|
name: nginx-plus-module-rtmp
|
||||||
state: present
|
state: present
|
||||||
when: type == "plus"
|
when: nginx_type == "plus"
|
||||||
|
|
||||||
- name: "(Setup: All NGINX) Load NGINX RTMP Module"
|
- name: "(Setup: All NGINX) Load NGINX RTMP Module"
|
||||||
lineinfile:
|
lineinfile:
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
package:
|
package:
|
||||||
name: nginx-module-xslt
|
name: nginx-module-xslt
|
||||||
state: present
|
state: present
|
||||||
when: type == "opensource"
|
when: nginx_type == "opensource"
|
||||||
|
|
||||||
- name: "(Install: All OSs) Install NGINX Plus XSLT Module"
|
- name: "(Install: All OSs) Install NGINX Plus XSLT Module"
|
||||||
package:
|
package:
|
||||||
name: nginx-plus-module-xslt
|
name: nginx-plus-module-xslt
|
||||||
state: present
|
state: present
|
||||||
when: type == "plus"
|
when: nginx_type == "plus"
|
||||||
|
|
||||||
- name: "(Setup: All NGINX) Load NGINX XSLT Module"
|
- name: "(Setup: All NGINX) Load NGINX XSLT Module"
|
||||||
lineinfile:
|
lineinfile:
|
||||||
|
@ -28,11 +28,11 @@
|
|||||||
when: ansible_os_family == "FreeBSD"
|
when: ansible_os_family == "FreeBSD"
|
||||||
notify: "(Handler: All OSs) Start NGINX"
|
notify: "(Handler: All OSs) Start NGINX"
|
||||||
|
|
||||||
when: install_from == "nginx_repository"
|
when: nginx_install_from == "nginx_repository"
|
||||||
|
|
||||||
- name: "(Install: Debian/Ubuntu/CentOS/RedHat/FreeBSD) Install NGINX"
|
- name: "(Install: Debian/Ubuntu/CentOS/RedHat/FreeBSD) Install NGINX"
|
||||||
package:
|
package:
|
||||||
name: nginx
|
name: nginx
|
||||||
state: present
|
state: present
|
||||||
when: install_from == "os_repository"
|
when: nginx_install_from == "os_repository"
|
||||||
notify: "(Handler: All OSs) Start NGINX"
|
notify: "(Handler: All OSs) Start NGINX"
|
||||||
|
@ -20,4 +20,4 @@
|
|||||||
notify: "(Handler: All OSs) Start NGINX"
|
notify: "(Handler: All OSs) Start NGINX"
|
||||||
|
|
||||||
- import_tasks: delete-license.yml
|
- import_tasks: delete-license.yml
|
||||||
when: delete_license
|
when: nginx_delete_license
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
package:
|
package:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: present
|
state: present
|
||||||
with_items: "{{ unit_modules }}"
|
with_items: "{{ nginx_unit_modules }}"
|
||||||
when: ansible_os_family != "FreeBSD"
|
when: ansible_os_family != "FreeBSD"
|
||||||
notify: "(Handler: Debian/Ubuntu/CentOS/RedHat) Start NGINX Unit"
|
notify: "(Handler: Debian/Ubuntu/CentOS/RedHat) Start NGINX Unit"
|
||||||
|
|
||||||
@ -11,6 +11,6 @@
|
|||||||
portinstall:
|
portinstall:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: present
|
state: present
|
||||||
with_items: "{{ unit_modules }}"
|
with_items: "{{ nginx_unit_modules }}"
|
||||||
when: ansible_os_family == "FreeBSD"
|
when: ansible_os_family == "FreeBSD"
|
||||||
notify: "(Handler: FreeBSD) Start NGINX Unit"
|
notify: "(Handler: FreeBSD) Start NGINX Unit"
|
||||||
|
@ -23,4 +23,4 @@
|
|||||||
notify: "(Handler: FreeBSD) Start NGINX Unit"
|
notify: "(Handler: FreeBSD) Start NGINX Unit"
|
||||||
|
|
||||||
- import_tasks: install-modules.yml
|
- import_tasks: install-modules.yml
|
||||||
when: unit_modules is defined and unit_modules
|
when: nginx_unit_modules is defined and nginx_unit_modules
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
server {
|
server {
|
||||||
listen {{ http_template_listen }};
|
listen {{ nginx_http_template_listen }};
|
||||||
server_name {{ http_template_server_name }};
|
server_name {{ nginx_http_template_server_name }};
|
||||||
|
|
||||||
#charset koi8-r;
|
#charset koi8-r;
|
||||||
#access_log /var/log/nginx/host.access.log main;
|
#access_log /var/log/nginx/host.access.log main;
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
user {{ main_template_user }};
|
user {{ nginx_main_template_user }};
|
||||||
worker_processes {{ main_template_worker_processes }};
|
worker_processes {{ nginx_main_template_worker_processes }};
|
||||||
|
|
||||||
error_log /var/log/nginx/error.log {{ main_template_error_level }};
|
error_log /var/log/nginx/error.log {{ nginx_main_template_error_level }};
|
||||||
pid /var/run/nginx.pid;
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
|
|
||||||
events {
|
events {
|
||||||
worker_connections {{ main_template_worker_connections }};
|
worker_connections {{ nginx_main_template_worker_connections }};
|
||||||
}
|
}
|
||||||
|
|
||||||
{% if http_template_enable %}
|
{% if nginx_http_template_enable %}
|
||||||
http {
|
http {
|
||||||
include /etc/nginx/mime.types;
|
include /etc/nginx/mime.types;
|
||||||
default_type application/octet-stream;
|
default_type application/octet-stream;
|
||||||
@ -23,7 +23,7 @@ http {
|
|||||||
sendfile on;
|
sendfile on;
|
||||||
#tcp_nopush on;
|
#tcp_nopush on;
|
||||||
|
|
||||||
keepalive_timeout {{ http_template_keepalive_timeout }};
|
keepalive_timeout {{ nginx_http_template_keepalive_timeout }};
|
||||||
|
|
||||||
#gzip on;
|
#gzip on;
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ http {
|
|||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if stream_template_enable %}
|
{% if nginx_stream_template_enable %}
|
||||||
stream {
|
stream {
|
||||||
include /etc/nginx/conf.d/stream/*.conf;
|
include /etc/nginx/conf.d/stream/*.conf;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
server {
|
server {
|
||||||
listen {{ stream_template_listen }};
|
listen {{ nginx_stream_template_listen }};
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
roles:
|
roles:
|
||||||
- ansible-role-nginx
|
- ansible-role-nginx
|
||||||
vars:
|
vars:
|
||||||
main_push_enable: true
|
nginx_main_push_enable: true
|
||||||
main_push_location: ../files/nginx.conf
|
nginx_main_push_location: ../files/nginx.conf
|
||||||
http_push_enable: true
|
nginx_http_push_enable: true
|
||||||
http_push_location: ../files/http/*.conf
|
nginx_http_push_location: ../files/http/*.conf
|
||||||
|
@ -5,4 +5,4 @@
|
|||||||
roles:
|
roles:
|
||||||
- ansible-role-nginx
|
- ansible-role-nginx
|
||||||
vars:
|
vars:
|
||||||
branch: stable
|
nginx_branch: stable
|
||||||
|
@ -5,6 +5,6 @@
|
|||||||
roles:
|
roles:
|
||||||
- ansible-role-nginx
|
- ansible-role-nginx
|
||||||
vars:
|
vars:
|
||||||
http_template_enable: true
|
nginx_http_template_enable: true
|
||||||
http_template_keepalive_timeout: 70
|
nginx_http_template_keepalive_timeout: 70
|
||||||
http_template_listen: 82
|
nginx_http_template_listen: 82
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
- ansible-role-nginx
|
- ansible-role-nginx
|
||||||
vars:
|
vars:
|
||||||
nginx_enable: false
|
nginx_enable: false
|
||||||
unit_enable: true
|
nginx_unit_enable: true
|
||||||
unit_modules:
|
nginx_unit_modules:
|
||||||
- unit-php
|
- unit-php
|
||||||
- unit-perl
|
- unit-perl
|
||||||
|
Loading…
Reference in New Issue
Block a user