entercloudsuite.haproxy
Ansible Role: HAProxy
NOTE: Development of ansible-haproxy
is now active on https://github.com/automium/ansible-haproxy
This role installs HAProxy on Ubuntu 16.04 (Xenial).
Requirements
You need Ansible version 2.4 or higher to use this role.
Role Variables
Most variables for the role are defined in defaults/main.yml
.
Example Playbook
To run with default variables:
- hosts: all
roles:
- role: entercloudsuite.haproxy
haproxy_user: haproxyuser
haproxy_pass: haproxypass
haproxy_conf: |
listen web
mode http
bind *:80
default-server port 80
server web-0 1.1.1.1:80 check
Testing
Testing is done with Molecule.
You can install Molecule or use docker-compose run --rm molecule
to run it in a local Docker container from the entercloudsuite/molecule project.
- Run
molecule create
to start the Docker container on your local machine. - Log into the running container with
molecule login
. - Edit the role files as needed.
- Add any external required roles in the molecule/default/requirements.yml file.
- Modify the molecule/default/playbook.yml as necessary.
- Create tests in the molecule/default/tests folder using the goos verifier.
- When everything is set, run
molecule converge
to execute the Ansible Playbook andmolecule verify
to run the tests.
Note: The converge process will check the syntax of the role. - To remove the Docker container, use
molecule destroy
.
To run all these steps in one command, just use molecule test
.
If you want to run the role on a VM, use the playbook_deploy.yml file like this: ansible-playbook ansible-haproxy/molecule/default/playbook_deploy.yml -i VM_IP_OR_FQDN, -u ubuntu --private-key private.pem
.
License
This project is licensed under MIT.
ansible-galaxy install entercloudsuite.haproxy