Skip to content

Commit

Permalink
Completely re-write role and support Ansible 2.0+
Browse files Browse the repository at this point in the history
  • Loading branch information
nickjj committed Oct 27, 2016
1 parent 19a3e0d commit aae6e69
Show file tree
Hide file tree
Showing 18 changed files with 738 additions and 483 deletions.
61 changes: 36 additions & 25 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,50 @@
---
language: "python"
python: "2.7"

sudo: required

env:
- SITE_AND_INVENTORY="tests/test.yml -i tests/inventory"
- distro: 'ubuntu1604'
init: '/lib/systemd/systemd'
run_opts: '--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro'
- distro: 'debian8'
init: '/lib/systemd/systemd'
run_opts: '--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro'

services:
- docker

before_install:
- "sudo apt-get update -qq"
- 'docker pull geerlingguy/docker-${distro}-ansible:latest'

install:
- "pip install ansible==1.8.3"
- "echo '[defaults]' > ansible.cfg"
- "echo 'roles_path = ../' >> ansible.cfg"
script:
- container_id=$(mktemp)
- >
docker run
--detach
--volume="${PWD}":/etc/ansible/roles/this_role:ro ${run_opts}
geerlingguy/docker-${distro}-ansible:latest "${init}" > "${container_id}"
before_script:
- "cd tests && node server &"
- "sleep 3"
- "chmod 777 /tmp/testproject.sock"
- "openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 -subj '/C=US/ST=Foo/L=Bar/O=Baz/CN=qux.com' -keyout /tmp/sslkey.key -out /tmp/sslcert.crt"
- >
docker exec --tty "$(cat ${container_id})" env TERM=xterm
ansible-playbook /etc/ansible/roles/this_role/tests/main.yml
--syntax-check
- >
docker exec --tty "$(cat ${container_id})" env TERM=xterm
ansible-playbook /etc/ansible/roles/this_role/tests/main.yml
script:
- "ansible-playbook $SITE_AND_INVENTORY --syntax-check"
- "ansible-playbook $SITE_AND_INVENTORY --connection=local -vvvv"
- idempotence=$(mktemp)
- >
docker exec "$(cat ${container_id})"
ansible-playbook /etc/ansible/roles/this_role/tests/main.yml
| tee -a ${idempotence}
- >
ansible-playbook $SITE_AND_INVENTORY --connection=local
tail ${idempotence}
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
- >
curl -s -o /dev/null -w "%{http_code}" http://localhost:8080
| grep -q '200'
&& (echo 'HTTP test: pass' && exit 0)
|| (echo 'HTTP test: fail' && exit 1)
- >
curl -k -s -o /dev/null -w "%{http_code}" https://localhost:8081
curl -k -s -o /dev/null -w "%{http_code}" https://localhost
| grep -q '200'
&& (echo 'HTTPs test: pass' && exit 0)
|| (echo 'HTTPs test: fail' && exit 1)
&& (echo 'HTTPS test: pass' && exit 0)
|| (echo 'HTTPS test: fail' && exit 1)
74 changes: 74 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Changelog

### v0.3.0

*Released: October 27nd 2016*

- Support for multiple vhosts
- Support for 0 or 1 more optionally load balanced upstreams
- Add many more configurable `nginx.conf` variables
- Add more optional customizations for vhosts
- Generate self signed SSL certificates for non-production environments
- Forces HTTPS (seamless integration with Let's Encrypt with 3rd party roles)
- Generate a unique `dhparam.pem` file when it doesn't exist
- Test against Ubuntu 16.04 LTS and Debian Jessie on Travis-CI
- Update to Ansible 2.0+

### v0.2.0

*Released: February 18th 2014*

- SSL protocols can be configured
- Redirect properly sets trailing forward slash

Thanks to PRs https://github.com/nickjj/ansible-nginx/pull/4 and https://github.com/nickjj/ansible-nginx/pull/5.

### v0.1.6

*Released: February 18th 2014*

- Option to disable the custom PPA
- Option to disable spdy
- Option to configure `server_names_hash_bucket_size`

Thanks to this PR https://github.com/nickjj/ansible-nginx/pull/3.

### v0.1.5

*Released: June 12th 2014*

- Merged #1 which introduces `nginx_ssl_manage_certs` (true / false)
- Now you can enable ssl but you can use whatever means necessary to transfer the certs

### v0.1.4

*Released: August 18th 2014*

- Fixed a bug that caused the handlers not to execute

### v0.1.3

*Released: June 2nd 2014*

- Fix a bug that caused testproj to be hard coded as the sites-available name
- Change nginx_extra_locations to take a text block so it's easier to add location block

### v0.1.2

*Released: June 1st 2014*

- Use a variable to store the apt-update cache time

### v0.1.1

*Released: May 9th 2014*

- Add a section linking to the Ansible Galaxy
- Update a few sentences and fix grammar mistakes
- Reload nginx if the SSL cert/key change

### v0.1.0

*Released: May 9th 2014*

- Initial release
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2016 Nick Janetakis nick.janetakis@gmail.com

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit aae6e69

Please sign in to comment.