{"id":19402137,"url":"https://github.com/robertdebock/ansible-role-haproxy","last_synced_at":"2025-04-24T07:31:05.674Z","repository":{"id":40544622,"uuid":"144106974","full_name":"robertdebock/ansible-role-haproxy","owner":"robertdebock","description":"Install and configure haproxy on your system.","archived":false,"fork":false,"pushed_at":"2025-03-06T12:31:20.000Z","size":316,"stargazers_count":16,"open_issues_count":0,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-20T10:16:40.104Z","etag":null,"topics":["ansible","cloud","haproxy","molecule","networking","playbook","tox"],"latest_commit_sha":null,"homepage":"https://robertdebock.nl/","language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robertdebock.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"robertdebock"}},"created_at":"2018-08-09T05:55:37.000Z","updated_at":"2025-04-09T10:13:13.000Z","dependencies_parsed_at":"2023-11-17T12:28:37.053Z","dependency_job_id":"f4bee05e-5833-43b4-a610-34ce14d8291f","html_url":"https://github.com/robertdebock/ansible-role-haproxy","commit_stats":null,"previous_names":[],"tags_count":76,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertdebock%2Fansible-role-haproxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertdebock%2Fansible-role-haproxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertdebock%2Fansible-role-haproxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertdebock%2Fansible-role-haproxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robertdebock","download_url":"https://codeload.github.com/robertdebock/ansible-role-haproxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250582848,"owners_count":21453918,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","cloud","haproxy","molecule","networking","playbook","tox"],"created_at":"2024-11-10T11:22:02.484Z","updated_at":"2025-04-24T07:31:05.415Z","avatar_url":"https://github.com/robertdebock.png","language":"Jinja","funding_links":["https://github.com/sponsors/robertdebock"],"categories":[],"sub_categories":[],"readme":"# [Ansible role haproxy](#haproxy)\n\nInstall and configure haproxy on your system.\n\n|GitHub|GitLab|Downloads|Version|\n|------|------|---------|-------|\n|[![github](https://github.com/robertdebock/ansible-role-haproxy/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-haproxy/actions)|[![gitlab](https://gitlab.com/robertdebock-iac/ansible-role-haproxy/badges/master/pipeline.svg)](https://gitlab.com/robertdebock-iac/ansible-role-haproxy)|[![downloads](https://img.shields.io/ansible/role/d/robertdebock/haproxy)](https://galaxy.ansible.com/robertdebock/haproxy)|[![Version](https://img.shields.io/github/release/robertdebock/ansible-role-haproxy.svg)](https://github.com/robertdebock/ansible-role-haproxy/releases/)|\n\n## [Example Playbook](#example-playbook)\n\nThis example is taken from [`molecule/default/converge.yml`](https://github.com/robertdebock/ansible-role-haproxy/blob/master/molecule/default/converge.yml) and is tested on each push, pull request and release.\n\n```yaml\n---\n- name: Converge\n  hosts: all\n  become: true\n  gather_facts: true\n\n  roles:\n    - role: robertdebock.haproxy\n      haproxy_frontends:\n        - name: http\n          address: \"*\"\n          port: 80\n          default_backend: backend\n        - name: https\n          address: \"*\"\n          port: 443\n          default_backend: backend\n          ssl: true\n          crts:\n            - /tmp/haproxy.keycrt\n        - name: smtp\n          address: \"*\"\n          port: 25\n          default_backend: smtp\n          mode: tcp\n        - name: prometheus\n          address: \"*\"\n          port: 8405\n          mode: http\n          http_request: use-service prometheus-exporter\n          no_log: true\n      haproxy_backend_default_balance: roundrobin\n      haproxy_backends:\n        - name: backend\n          httpcheck: true\n          # You can tell how the health check must be done.\n          # This requires haproxy version 2\n          # http_check:\n          #   send:\n          #     method: GET\n          #     uri: /health.html\n          #   expect: status 200\n          balance: roundrobin\n          # You can refer to hosts in an Ansible group.\n          # The `ansible_default_ipv4` will be used as an address to connect to.\n          servers: \"{{ groups['all'] }}\"\n          port: 8080\n          options:\n            - check\n        - name: smtp\n          balance: leastconn\n          mode: tcp\n          # You can also refer to a list of servers.\n          servers:\n            - name: first\n              address: \"127.0.0.1\"\n              port: 25\n            - name: second\n              address: \"127.0.0.2\"\n              port: 25\n          port: 25\n        - name: vault\n          mode: tcp\n          httpcheck: GET /v1/sys/health HTTP/1.1\n          servers: \"{{ groups['all'] }}\"\n          http_send_name_header: Host\n          port: 8200\n          options:\n            - check\n            - check-ssl\n            - ssl verify none\n\n      haproxy_listen_default_balance: roundrobin\n      haproxy_listens:\n        - name: listen\n          address: \"*\"\n          httpcheck: true\n          listen_port: 8081\n          balance: roundrobin\n          # You can refer to hosts in an Ansible group.\n          # The `ansible_default_ipv4` will be used as an address to connect to.\n          servers: \"{{ groups['all'] }}\"\n          port: 8080\n          options:\n            - maxconn 100000\n```\n\nThe machine needs to be prepared. In CI this is done using [`molecule/default/prepare.yml`](https://github.com/robertdebock/ansible-role-haproxy/blob/master/molecule/default/prepare.yml):\n\n```yaml\n---\n- name: Prepare\n  hosts: all\n  become: true\n  gather_facts: false\n\n  roles:\n    - role: robertdebock.bootstrap\n    - role: robertdebock.core_dependencies\n    - role: robertdebock.epel\n    - role: robertdebock.buildtools\n    - role: robertdebock.python_pip\n    - role: robertdebock.openssl\n      openssl_key_directory: /tmp\n      openssl_items:\n        - name: haproxy\n          common_name: \"{{ ansible_fqdn }}\"\n    # This role is applied to serve as a mock \"backend\" server. See `molecule/default/verify.yml`.\n    - role: robertdebock.httpd\n      httpd_port: 8080\n\n  vars:\n    _httpd_data_directory:\n      default: /var/www/html\n      Alpine: /var/www/localhost/htdocs\n      Suse: /srv/www/htdocs\n\n    httpd_data_directory: \"{{ _httpd_data_directory[ansible_os_family] | default(_httpd_data_directory['default'] ) }}\"\n  post_tasks:\n    - name: Place health check\n      ansible.builtin.copy:\n        content: 'ok'\n        dest: \"{{ httpd_data_directory }}/health.html\"\n\n    - name: Place sample page\n      ansible.builtin.copy:\n        content: 'Hello world!'\n        dest: \"{{ httpd_data_directory }}/index.html\"\n```\n\nAlso see a [full explanation and example](https://robertdebock.nl/how-to-use-these-roles.html) on how to use these roles.\n\n## [Role Variables](#role-variables)\n\nThe default values for the variables are set in [`defaults/main.yml`](https://github.com/robertdebock/ansible-role-haproxy/blob/master/defaults/main.yml):\n\n```yaml\n---\n# defaults file for haproxy\n\n# Configure stats in HAProxy?\nhaproxy_stats: true\nhaproxy_stats_port: 1936\nhaproxy_stats_bind_addr: \"0.0.0.0\"\n\n# Default setttings for HAProxy.\nhaproxy_retries: 3\nhaproxy_timeout_http_request: 10s\nhaproxy_timeout_connect: 10s\nhaproxy_timeout_client: 1m\nhaproxy_timeout_server: 1m\nhaproxy_timeout_http_keep_alive: 10s\nhaproxy_timeout_check: 10s\nhaproxy_maxconn: 3000\n\n# A list of frontends. See `molecule/default/converge.yml` for an example.\nhaproxy_frontends: []\nhaproxy_backend_default_balance: roundrobin\nhaproxy_backends: []\n\n# For the listening lists:\nhaproxy_listen_default_balance: roundrobin\nhaproxy_listens: []\n```\n\n## [Requirements](#requirements)\n\n- pip packages listed in [requirements.txt](https://github.com/robertdebock/ansible-role-haproxy/blob/master/requirements.txt).\n\n## [State of used roles](#state-of-used-roles)\n\nThe following roles are used to prepare a system. You can prepare your system in another way.\n\n| Requirement | GitHub | GitLab |\n|-------------|--------|--------|\n|[robertdebock.bootstrap](https://galaxy.ansible.com/robertdebock/bootstrap)|[![Build Status GitHub](https://github.com/robertdebock/ansible-role-bootstrap/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-bootstrap/actions)|[![Build Status GitLab](https://gitlab.com/robertdebock-iac/ansible-role-bootstrap/badges/master/pipeline.svg)](https://gitlab.com/robertdebock-iac/ansible-role-bootstrap)|\n|[robertdebock.buildtools](https://galaxy.ansible.com/robertdebock/buildtools)|[![Build Status GitHub](https://github.com/robertdebock/ansible-role-buildtools/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-buildtools/actions)|[![Build Status GitLab](https://gitlab.com/robertdebock-iac/ansible-role-buildtools/badges/master/pipeline.svg)](https://gitlab.com/robertdebock-iac/ansible-role-buildtools)|\n|[robertdebock.core_dependencies](https://galaxy.ansible.com/robertdebock/core_dependencies)|[![Build Status GitHub](https://github.com/robertdebock/ansible-role-core_dependencies/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-core_dependencies/actions)|[![Build Status GitLab](https://gitlab.com/robertdebock-iac/ansible-role-core_dependencies/badges/master/pipeline.svg)](https://gitlab.com/robertdebock-iac/ansible-role-core_dependencies)|\n|[robertdebock.epel](https://galaxy.ansible.com/robertdebock/epel)|[![Build Status GitHub](https://github.com/robertdebock/ansible-role-epel/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-epel/actions)|[![Build Status GitLab](https://gitlab.com/robertdebock-iac/ansible-role-epel/badges/master/pipeline.svg)](https://gitlab.com/robertdebock-iac/ansible-role-epel)|\n|[robertdebock.httpd](https://galaxy.ansible.com/robertdebock/httpd)|[![Build Status GitHub](https://github.com/robertdebock/ansible-role-httpd/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-httpd/actions)|[![Build Status GitLab](https://gitlab.com/robertdebock-iac/ansible-role-httpd/badges/master/pipeline.svg)](https://gitlab.com/robertdebock-iac/ansible-role-httpd)|\n|[robertdebock.openssl](https://galaxy.ansible.com/robertdebock/openssl)|[![Build Status GitHub](https://github.com/robertdebock/ansible-role-openssl/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-openssl/actions)|[![Build Status GitLab](https://gitlab.com/robertdebock-iac/ansible-role-openssl/badges/master/pipeline.svg)](https://gitlab.com/robertdebock-iac/ansible-role-openssl)|\n|[robertdebock.python_pip](https://galaxy.ansible.com/robertdebock/python_pip)|[![Build Status GitHub](https://github.com/robertdebock/ansible-role-python_pip/workflows/Ansible%20Molecule/badge.svg)](https://github.com/robertdebock/ansible-role-python_pip/actions)|[![Build Status GitLab](https://gitlab.com/robertdebock-iac/ansible-role-python_pip/badges/master/pipeline.svg)](https://gitlab.com/robertdebock-iac/ansible-role-python_pip)|\n\n## [Context](#context)\n\nThis role is a part of many compatible roles. Have a look at [the documentation of these roles](https://robertdebock.nl/) for further information.\n\nHere is an overview of related roles:\n![dependencies](https://raw.githubusercontent.com/robertdebock/ansible-role-haproxy/png/requirements.png \"Dependencies\")\n\n## [Compatibility](#compatibility)\n\nThis role has been tested on these [container images](https://hub.docker.com/u/robertdebock):\n\n|container|tags|\n|---------|----|\n|[EL](https://hub.docker.com/r/robertdebock/enterpriselinux)|9|\n|[Debian](https://hub.docker.com/r/robertdebock/debian)|all|\n|[Fedora](https://hub.docker.com/r/robertdebock/fedora)|39, 40|\n|[Ubuntu](https://hub.docker.com/r/robertdebock/ubuntu)|all|\n\nThe minimum version of Ansible required is 2.12, tests have been done to:\n\n- The previous version.\n- The current version.\n- The development version.\n\nIf you find issues, please register them in [GitHub](https://github.com/robertdebock/ansible-role-haproxy/issues).\n\n## [License](#license)\n\n[Apache-2.0](https://github.com/robertdebock/ansible-role-haproxy/blob/master/LICENSE).\n\n## [Author Information](#author-information)\n\n[robertdebock](https://robertdebock.nl/)\n\nPlease consider [sponsoring me](https://github.com/sponsors/robertdebock).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertdebock%2Fansible-role-haproxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobertdebock%2Fansible-role-haproxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertdebock%2Fansible-role-haproxy/lists"}