Improve tests (#90)

* Update .travis.yml

* Create Travis build matrix

* Add nginx-modules.yml test playbook to Travis build matrix

* Improve template test playbook

* Change HTML template variables from Ansible to NGINX variables
This commit is contained in:
Alessandro Fael Garcia 2019-01-21 12:19:30 +01:00 committed by GitHub
parent fdfff7efca
commit 1d3b03ea2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 278 additions and 125 deletions

View File

@ -2,122 +2,194 @@
sudo: required
services:
- docker
env:
- distribution: centos
matrix:
include:
- env:
distribution: centos
version: 6
playbook: basic
- distribution: centos
- env:
distribution: centos
version: 6
playbook: modules
- env:
distribution: centos
version: 6
playbook: push
- distribution: centos
- env:
distribution: centos
version: 6
playbook: stable
- distribution: centos
- env:
distribution: centos
version: 6
playbook: template
- distribution: centos
- env:
distribution: centos
version: 6
playbook: unit
- distribution: centos
- env:
distribution: centos
version: 7
playbook: basic
- distribution: centos
- env:
distribution: centos
version: 7
playbook: template
- distribution: centos
version: 7
playbook: stable
- distribution: centos
playbook: modules
- env:
distribution: centos
version: 7
playbook: push
- distribution: centos
- env:
distribution: centos
version: 7
playbook: template
- env:
distribution: centos
version: 7
playbook: stable
- env:
distribution: centos
version: 7
playbook: unit
- distribution: debian
- env:
distribution: debian
version: jessie
playbook: basic
- distribution: debian
- env:
distribution: debian
version: jessie
playbook: template
- distribution: debian
version: jessie
playbook: stable
- distribution: debian
playbook: modules
- env:
distribution: debian
version: jessie
playbook: push
- distribution: debian
- env:
distribution: debian
version: jessie
playbook: template
- env:
distribution: debian
version: jessie
playbook: stable
- env:
distribution: debian
version: jessie
playbook: unit
- distribution: debian
- env:
distribution: debian
version: stretch
playbook: basic
- distribution: debian
- env:
distribution: debian
version: stretch
playbook: template
- distribution: debian
version: stretch
playbook: stable
- distribution: debian
playbook: modules
- env:
distribution: debian
version: stretch
playbook: push
- distribution: debian
- env:
distribution: debian
version: stretch
playbook: template
- env:
distribution: debian
version: stretch
playbook: stable
- env:
distribution: debian
version: stretch
playbook: unit
- distribution: ubuntu
- env:
distribution: ubuntu
version: trusty
playbook: basic
- distribution: ubuntu
- env:
distribution: ubuntu
version: trusty
playbook: template
- distribution: ubuntu
version: trusty
playbook: stable
- distribution: ubuntu
playbook: modules
- env:
distribution: ubuntu
version: trusty
playbook: push
- distribution: ubuntu
- env:
distribution: ubuntu
version: trusty
playbook: template
- env:
distribution: ubuntu
version: trusty
playbook: stable
- env:
distribution: ubuntu
version: xenial
playbook: basic
- distribution: ubuntu
- env:
distribution: ubuntu
version: xenial
playbook: template
- distribution: ubuntu
version: xenial
playbook: stable
- distribution: ubuntu
playbook: modules
- env:
distribution: ubuntu
version: xenial
playbook: push
- distribution: ubuntu
- env:
distribution: ubuntu
version: xenial
playbook: template
- env:
distribution: ubuntu
version: xenial
playbook: stable
- env:
distribution: ubuntu
version: xenial
playbook: unit
- distribution: ubuntu
- env:
distribution: ubuntu
version: artful
playbook: basic
- distribution: ubuntu
- env:
distribution: ubuntu
version: artful
playbook: modules
- env:
distribution: ubuntu
version: artful
playbook: push
- distribution: ubuntu
- env:
distribution: ubuntu
version: artful
playbook: stable
- distribution: ubuntu
- env:
distribution: ubuntu
version: artful
playbook: template
- distribution: ubuntu
- env:
distribution: ubuntu
version: artful
playbook: unit
- distribution: ubuntu
- env:
distribution: ubuntu
version: bionic
playbook: basic
- distribution: ubuntu
- env:
distribution: ubuntu
version: bionic
playbook: modules
- env:
distribution: ubuntu
version: bionic
playbook: push
- distribution: ubuntu
- env:
distribution: ubuntu
version: bionic
playbook: stable
- distribution: ubuntu
- env:
distribution: ubuntu
version: bionic
playbook: template
- distribution: ubuntu
- env:
distribution: ubuntu
version: bionic
playbook: unit
before_install:

View File

@ -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:

View File

@ -81,8 +81,8 @@ clearTimeout(ref);
<img alt="NGINX Logo" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAWAAAABICAMAAAD/N9+RAAAAVFBMVEUAAAAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQAAmQDBect+AAAAG3RSTlMAB0AY8SD5SM82v1npsJ/YjSl0EVLftqllgMdZgsoQAAAHd0lEQVR42szZ6XabMBCG4ZGFxSazLzZz//fZc9I4JpbEN8LQ0/dnGwJ5DJGG0HdpM9kkuzVXiqussmRpLrRdnwqDp9ePyY7zXdFbqptHOz00RTVUxWiyquvJ26Upknp2/heWN0Uyzt3qYtKMn805ybsW/LdK01YVC6sVELH81XJ9o6j5q6Qkcepe83dJp8ipf161HSgm1TyPK5//cuN1d5KmE342bsnkLK6hre78LNG0KuWfOrFDwats69w8ln+qFIlrx9Vxf8808e8eJGx9YEXhCpZ3kX2gfFtbrX4m05IonTE7wsGLnpXY1/Kqr3v/5r+NcAOvy8HXCRt74W+alH568KqCJKmM37LafVhe3ZTU1/mmA7uV9Ar8vPjZVCPDZI+CDdwFC68yIooZnbhmIAx8XyoZu5mcYO9HzhSo47gGCqR53ULPlAGPkuyazJVeKWYsjH15Djy/VhPO8LoM/OJE4XNfeJ19LUfRj18KF9gLA2GZL4/UsLdFHQVccWyTCDjZD9wm7Kt2PgIgjH3ZBlf46iDgnOO7nwusavZmVoCaPU0q1pcnshyoOwa44PiS66nANw7U0isbK5x7j3gQB0uPAB54T8WZwA/RHrxhLIx9TbsBnLSfA6uRd9WdBzywCFiNUcJ5wr4eRByu7j8G7nhfpj0LuE0A8OtsSBj7ZooIL+dyYLxFm27+EvfSzgHua/GYXrK3Qol9a03bwNxEAeMt2ix/bptzgCeGwFhY7ouAufwIOA/PSni3nJ8B3DAElgtjXwxs8k+Al/BdiVfDWh0PPDAAj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4EPFfz8L18zzKmDxIKSCN95LIuBGr3GujpevErqxGQDuLaPuyUAfBAPGg6Mx4OME2DhQVgUJWAIzQnBFfRAeMI5N1XEjBBiwjCxg0+qHYG7wt/GA8capDh+CqYkpCoykjPKWesio2gywEwD4qDEuDNjUJGCptQqUAB5MB3w1APBhg4gYsPQtCbib00Zpi3wrwM1FAOBjR2lrZBXCARY3J623bAS4yAQAPnIYHAOWkgSc2xS+T7MV4CAA8LF2BhiwBAwYP4+lPBsBdgIAH2XIgQHjTf+SrRw5auEAG5Dg9ID3t5TBgM3EWR88eMAVCVieYM5aDXgHUyQAmKiZR9nIFckJC/gFnALUgHew9QKAiZq5A3+EXspDAw7gP64GvIcxXQvfHl2B7tiozSf+y1JSNQ31gRYDQb6HteKQ4B3s4QucflRrDW8OKiHBujCO3s0u5qAjwKR0vnkDozL1emgd5W6EWa1ud7l97G0n3jhYzACOEMlHtVpjeBA/mLf/7IOoQsa7y+b7GDR3Rbw98fKQLy+5xv7VIXowIhy1ztUfbdzLYrz7cbrvRb/K+nf7wPPQpAXsEQ/7l2AXW97/AGkCwaNsIif8zU3y5eZaO/mK/jKDV1s872/Fz11K5TLE1zzEiP1km8ndDMcj3JvmFfqdvubhD8TgHPiN+LViAAAAAElFTkSuQmCC"/>
<div class="info">
<p><span>Web Server name:</span> <span> {{ item.value.web_server_name }} </span></p>
<p><span>Server name:</span> <span> {{ ansible_hostname }} </span></p>
<p><span>Server address:</span> <span> {{ ansible_eth0.ipv4.address }} </span></p>
<p><span>Server name:</span> <span>server_hostname</span></p>
<p><span>Server address:</span> <span>server_address</span></p>
<p><span>User Agent:</span> <span><small>client_browser</small></span></p>
<p class="smaller"><span>URI:</span> <span>server_url</span></p>
<p class="smaller"><span>Doc Root:</span> <span>document_root</span></p>

View File

@ -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

View File

@ -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