diff --git a/.travis.yml b/.travis.yml
index 15ea710..0dc5197 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,124 +2,196 @@
sudo: required
services:
- docker
-env:
- - distribution: centos
- version: 6
- playbook: basic
- - distribution: centos
- version: 6
- playbook: push
- - distribution: centos
- version: 6
- playbook: stable
- - distribution: centos
- version: 6
- playbook: template
- - distribution: centos
- version: 6
- playbook: unit
- - distribution: centos
- version: 7
- playbook: basic
- - distribution: centos
- version: 7
- playbook: template
- - distribution: centos
- version: 7
- playbook: stable
- - distribution: centos
- version: 7
- playbook: push
- - distribution: centos
- version: 7
- playbook: unit
- - distribution: debian
- version: jessie
- playbook: basic
- - distribution: debian
- version: jessie
- playbook: template
- - distribution: debian
- version: jessie
- playbook: stable
- - distribution: debian
- version: jessie
- playbook: push
- - distribution: debian
- version: jessie
- playbook: unit
- - distribution: debian
- version: stretch
- playbook: basic
- - distribution: debian
- version: stretch
- playbook: template
- - distribution: debian
- version: stretch
- playbook: stable
- - distribution: debian
- version: stretch
- playbook: push
- - distribution: debian
- version: stretch
- playbook: unit
- - distribution: ubuntu
- version: trusty
- playbook: basic
- - distribution: ubuntu
- version: trusty
- playbook: template
- - distribution: ubuntu
- version: trusty
- playbook: stable
- - distribution: ubuntu
- version: trusty
- playbook: push
- - distribution: ubuntu
- version: xenial
- playbook: basic
- - distribution: ubuntu
- version: xenial
- playbook: template
- - distribution: ubuntu
- version: xenial
- playbook: stable
- - distribution: ubuntu
- version: xenial
- playbook: push
- - distribution: ubuntu
- version: xenial
- playbook: unit
- - distribution: ubuntu
- version: artful
- playbook: basic
- - distribution: ubuntu
- version: artful
- playbook: push
- - distribution: ubuntu
- version: artful
- playbook: stable
- - distribution: ubuntu
- version: artful
- playbook: template
- - distribution: ubuntu
- version: artful
- playbook: unit
- - distribution: ubuntu
- version: bionic
- playbook: basic
- - distribution: ubuntu
- version: bionic
- playbook: push
- - distribution: ubuntu
- version: bionic
- playbook: stable
- - distribution: ubuntu
- version: bionic
- playbook: template
- - distribution: ubuntu
- version: bionic
- playbook: unit
+matrix:
+ include:
+ - env:
+ distribution: centos
+ version: 6
+ playbook: basic
+ - env:
+ distribution: centos
+ version: 6
+ playbook: modules
+ - env:
+ distribution: centos
+ version: 6
+ playbook: push
+ - env:
+ distribution: centos
+ version: 6
+ playbook: stable
+ - env:
+ distribution: centos
+ version: 6
+ playbook: template
+ - env:
+ distribution: centos
+ version: 6
+ playbook: unit
+ - env:
+ distribution: centos
+ version: 7
+ playbook: basic
+ - env:
+ distribution: centos
+ version: 7
+ playbook: modules
+ - env:
+ distribution: centos
+ version: 7
+ playbook: push
+ - env:
+ distribution: centos
+ version: 7
+ playbook: template
+ - env:
+ distribution: centos
+ version: 7
+ playbook: stable
+ - env:
+ distribution: centos
+ version: 7
+ playbook: unit
+ - env:
+ distribution: debian
+ version: jessie
+ playbook: basic
+ - env:
+ distribution: debian
+ version: jessie
+ playbook: modules
+ - env:
+ distribution: debian
+ version: jessie
+ playbook: push
+ - env:
+ distribution: debian
+ version: jessie
+ playbook: template
+ - env:
+ distribution: debian
+ version: jessie
+ playbook: stable
+ - env:
+ distribution: debian
+ version: jessie
+ playbook: unit
+ - env:
+ distribution: debian
+ version: stretch
+ playbook: basic
+ - env:
+ distribution: debian
+ version: stretch
+ playbook: modules
+ - env:
+ distribution: debian
+ version: stretch
+ playbook: push
+ - env:
+ distribution: debian
+ version: stretch
+ playbook: template
+ - env:
+ distribution: debian
+ version: stretch
+ playbook: stable
+ - env:
+ distribution: debian
+ version: stretch
+ playbook: unit
+ - env:
+ distribution: ubuntu
+ version: trusty
+ playbook: basic
+ - env:
+ distribution: ubuntu
+ version: trusty
+ playbook: modules
+ - env:
+ distribution: ubuntu
+ version: trusty
+ playbook: push
+ - env:
+ distribution: ubuntu
+ version: trusty
+ playbook: template
+ - env:
+ distribution: ubuntu
+ version: trusty
+ playbook: stable
+ - env:
+ distribution: ubuntu
+ version: xenial
+ playbook: basic
+ - env:
+ distribution: ubuntu
+ version: xenial
+ playbook: modules
+ - env:
+ distribution: ubuntu
+ version: xenial
+ playbook: push
+ - env:
+ distribution: ubuntu
+ version: xenial
+ playbook: template
+ - env:
+ distribution: ubuntu
+ version: xenial
+ playbook: stable
+ - env:
+ distribution: ubuntu
+ version: xenial
+ playbook: unit
+ - env:
+ distribution: ubuntu
+ version: artful
+ playbook: basic
+ - env:
+ distribution: ubuntu
+ version: artful
+ playbook: modules
+ - env:
+ distribution: ubuntu
+ version: artful
+ playbook: push
+ - env:
+ distribution: ubuntu
+ version: artful
+ playbook: stable
+ - env:
+ distribution: ubuntu
+ version: artful
+ playbook: template
+ - env:
+ distribution: ubuntu
+ version: artful
+ playbook: unit
+ - env:
+ distribution: ubuntu
+ version: bionic
+ playbook: basic
+ - env:
+ distribution: ubuntu
+ version: bionic
+ playbook: modules
+ - env:
+ distribution: ubuntu
+ version: bionic
+ playbook: push
+ - env:
+ distribution: ubuntu
+ version: bionic
+ playbook: stable
+ - env:
+ distribution: ubuntu
+ version: bionic
+ playbook: template
+ - env:
+ distribution: ubuntu
+ version: bionic
+ playbook: unit
before_install:
- 'sudo docker pull ${distribution}:${version}'
- 'sudo docker build --no-cache --rm --file=tests/dockerfiles/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible tests'
diff --git a/defaults/main.yml b/defaults/main.yml
index 16bf248..5659334 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -154,8 +154,6 @@ nginx_main_template:
# Enable creating dynamic templated NGINX HTTP configuration files.
# Defaults will not produce a valid configuration. Instead they are meant to showcase
# the options available for templating. Each key represents a new configuration file.
-# Comment out load_balancer or web_server depending on whether you wish to create a web server
-# or load balancer configuration file.
nginx_http_template_enable: false
nginx_http_template:
default:
diff --git a/templates/www/index.html.j2 b/templates/www/index.html.j2
index 1872576..87e7467 100644
--- a/templates/www/index.html.j2
+++ b/templates/www/index.html.j2
@@ -81,8 +81,8 @@ clearTimeout(ref);
Web Server name: {{ item.value.web_server_name }}
-Server name: {{ ansible_hostname }}
-Server address: {{ ansible_eth0.ipv4.address }}
+Server name: server_hostname
+Server address: server_address
User Agent: client_browser
URI: server_url
Doc Root: document_root
diff --git a/tests/playbooks/nginx-modules.yml b/tests/playbooks/nginx-modules.yml new file mode 100644 index 0000000..1f99662 --- /dev/null +++ b/tests/playbooks/nginx-modules.yml @@ -0,0 +1,15 @@ +--- +- hosts: localhost + become: true + remote_user: root + roles: + - ansible-role-nginx + vars: + nginx_modules: + njs: true + perl: true + waf: false + geoip: true + image_filter: true + rtmp: true + xslt: true diff --git a/tests/playbooks/nginx-template.yml b/tests/playbooks/nginx-template.yml index 367cbbc..b995b22 100644 --- a/tests/playbooks/nginx-template.yml +++ b/tests/playbooks/nginx-template.yml @@ -7,19 +7,87 @@ vars: nginx_http_template_enable: true nginx_http_template: - default: + app: template_file: http/default.conf.j2 conf_file_name: default.conf conf_file_location: /etc/nginx/conf.d/ port: 80 server_name: localhost error_page: /usr/share/nginx/html + reverse_proxy: + locations: + frontend: + location: / + proxy_pass: http://frontend_servers/ + backend: + location: /backend + proxy_pass: http://backend_servers/ + upstreams: + upstream_1: + name: frontend_servers + lb_method: least_conn + zone_name: frontend + zone_size: 64k + sticky_cookie: false + servers: + frontend_server_1: + address: localhost + port: 8081 + weight: 1 + health_check: max_fails=3 fail_timeout=5s + upstream_2: + name: backend_servers + lb_method: least_conn + zone_name: backend + zone_size: 64k + sticky_cookie: false + servers: + backend_server_1: + address: localhost + port: 8082 + weight: 1 + health_check: max_fails=3 fail_timeout=5s + frontend: + template_file: http/default.conf.j2 + conf_file_name: frontend_default.conf + conf_file_location: /etc/nginx/conf.d/ + port: 8081 + server_name: localhost + error_page: /usr/share/nginx/html autoindex: false web_server: locations: default: location: / html_file_location: /usr/share/nginx/html - html_file_name: index.html + html_file_name: frontend_index.html autoindex: false - http_demo_conf: false + http_demo_conf: true + backend: + template_file: http/default.conf.j2 + conf_file_name: backend_default.conf + conf_file_location: /etc/nginx/conf.d/ + port: 8082 + server_name: localhost + error_page: /usr/share/nginx/html + autoindex: false + web_server: + locations: + default: + location: / + html_file_location: /usr/share/nginx/html + html_file_name: backend_index.html + autoindex: false + http_demo_conf: true + nginx_html_demo_template_enable: true + nginx_html_demo_template: + frontend: + template_file: www/index.html.j2 + html_file_name: frontend_index.html + html_file_location: /usr/share/nginx/html + web_server_name: Frontend + backend: + template_file: www/index.html.j2 + html_file_name: backend_index.html + html_file_location: /usr/share/nginx/html + web_server_name: Backend