https://github.com/holms/ansible-balancer
Ansible role of nginx load balancer
https://github.com/holms/ansible-balancer
Last synced: 6 months ago
JSON representation
Ansible role of nginx load balancer
- Host: GitHub
- URL: https://github.com/holms/ansible-balancer
- Owner: holms
- License: mit
- Created: 2014-10-04T03:21:52.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2016-06-20T07:42:24.000Z (about 10 years ago)
- Last Synced: 2024-04-14T20:16:37.983Z (about 2 years ago)
- Homepage:
- Size: 6.84 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# balancer [](https://travis-ci.org/holms/ansible-balancer)
Load Balancer with nginx role.
This role is only for SSL termination setup. Everything from HTTP will be redirected to HTTPS. You can fork and change that or you can contribute to make this optional.
## Requirements
Latest Ansible from pip
## Platforms
- Ubuntu
- Debian
## Role Variables
Name | Default | Value
:----------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------- | :-----------------------------------------------
balancer_vhosts | - { name: "example1", upstreams: ['myserver1.com', 'myserver2.com' ] }
- { name: "example2", upstreams: ['myserver1.com', 'myserver2.com' ] } | a list of vhosts
balancer_ssl_key | *None* | Path to SSL key
balancer_ssl_pem | *None* | Path to PEM file
balancer_ssl_crt | *None* | Path to CRT file
balancer_ssl_trusted_crt | *None* | Path to CRT file of your trusted ssl certificate
balancer_ssl_trusted_key | *None* | Path to KEY file of your trusted ssl certificate
You need to use either trusted certificates or self signed, using will fail your nginx config
## Example
```
- hosts: localhost
remote_user: root
vars:
- balancer_ssl_key: "/etc/ssl/certs/server.key"
- balancer_ssl_crt: "/etc/ssl/certs/server.crt"
- balancer_ssl_pem: "/etc/ssl/certs/server.pem"
- balancer_vhosts:
- { name: "my.project.com",
upstreams: [
'node01.myproject.com',
'node02.myproject.com'
]}
roles:
- { role: balancer }
```
Or generate `upstreams` list from inventory vars group.
Inventory file:
```
[myproject]
node[01:02].myproject.com
```
Playbook:
```
- hosts: localhost
remote_user: root
vars:
- balancer_ssl_key: "/etc/ssl/certs/server.key"
- balancer_ssl_crt: "/etc/ssl/certs/server.crt"
- balancer_ssl_pem: "/etc/ssl/certs/server.pem"
- balancer_vhosts:
- { name: "my.project.com", upstreams: "{{ groups.myproject }}" }
roles:
- { role: balancer }
```
## License
MIT
## Author Information
Roman Gorodeckij ([holms@holms.lt](mailto:holms@holms.lt))