66 lines
2.3 KiB
Markdown
66 lines
2.3 KiB
Markdown
# haproxy
|
|
|
|
The present role:
|
|
- install HAProxy
|
|
- push a default configuration file
|
|
- generate a self-signed certificate
|
|
|
|
By default, HAProxy will be installed from Debian backports repository, but you can optionnaly choose to install it from HAPRoxy's Debian repository (and choose the version).
|
|
Configuration file could also be overrided.
|
|
|
|
## Optional: Use HAProxy's official Debian repository
|
|
|
|
You can enable installation from the official [HAProxy Debian repository](https://haproxy.debian.net/) by setting the following variable in your playbook or inventory:
|
|
|
|
```yaml
|
|
haproxy_use_debian_repo: true
|
|
```
|
|
|
|
You can also override the following variables if needed:
|
|
|
|
```yaml
|
|
haproxy_debian_repo_url: 'http://haproxy.debian.net'
|
|
haproxy_debian_repo_distribution: '{{ ansible_distribution_release }}'
|
|
haproxy_debian_repo_component: 'main'
|
|
haproxy_debian_repo_key_url: 'https://haproxy.debian.net/bernat.debian.org.gpg'
|
|
haproxy_version: '3.2' # default version
|
|
```
|
|
|
|
The apt source line will look like:
|
|
|
|
```
|
|
deb [signed-by=/usr/share/keyrings/haproxy.debian.net.gpg] http://haproxy.debian.net bookworm-backports-3.2 main
|
|
```
|
|
|
|
By default, the role installs HAProxy from Debian backports. If you enable the repository, it will be added and HAProxy will be installed from there.
|
|
|
|
## Overriding the HAProxy configuration file
|
|
|
|
If you want to use your own configuration file (outside the role), set the variable `haproxy_custom_configuration_file` to the path of your file. The role will copy it to `/etc/haproxy/haproxy.cfg` instead of rendering the template.
|
|
|
|
Example:
|
|
|
|
```yaml
|
|
haproxy_custom_configuration_file: '/path/to/my/haproxy.cfg'
|
|
```
|
|
|
|
If not set, the default template `haproxy.cfg.j2` will be used.
|
|
|
|
You can enable installation from the official [HAProxy Debian repository](https://haproxy.debian.net/) by setting the following variable in your playbook or inventory:
|
|
|
|
```yaml
|
|
haproxy_use_debian_repo: true
|
|
```
|
|
|
|
You can also override the following variables if needed:
|
|
|
|
```yaml
|
|
haproxy_debian_repo_url: 'http://haproxy.debian.net'
|
|
haproxy_debian_repo_distribution: '{{ ansible_distribution_release }}'
|
|
haproxy_debian_repo_component: 'main'
|
|
haproxy_debian_repo_key_url: 'https://haproxy.debian.net/haproxy-archive-keyring.gpg'
|
|
```
|
|
|
|
By default, the role installs HAProxy from Debian backports. If you enable the repository, it will be added and HAProxy will be installed from there.
|
|
|