add haproxy repo, custom config files & readme

This commit is contained in:
Ludovic Cartier
2025-09-23 14:59:37 +02:00
parent 58ef95e654
commit 141ec62e2c
8 changed files with 123 additions and 18 deletions

View File

@@ -22,7 +22,19 @@
notify:
- haproxy restart
- name: haproxy | copy configuration file
- name: haproxy | copy custom configuration file
copy:
src: "{{ haproxy_custom_configuration_file }}"
dest: '/etc/haproxy/haproxy.cfg'
owner: root
group: root
mode: '0440'
validate: 'haproxy -f %s -c {% if haproxy_accept_warnings %}-q{% endif %}'
when: haproxy_custom_configuration_file is defined
notify:
- haproxy reload
- name: haproxy | copy default configuration file
template:
src: haproxy.cfg.j2
dest: '/etc/haproxy/haproxy.cfg'
@@ -30,5 +42,6 @@
group: root
mode: '0440'
validate: 'haproxy -f %s -c {% if haproxy_accept_warnings %}-q{% endif %}'
when: haproxy_custom_configuration_file is not defined
notify:
- haproxy reload

View File

@@ -1,7 +0,0 @@
---
- name: haproxy | installation
apt:
name: haproxy
state: present
default_release: "{{ ansible_distribution_release }}-backports"

View File

@@ -1,11 +1,13 @@
---
- name: haproxy | add backports repository
- name: haproxy | add Debian backports repository
apt_repository:
repo: deb http://deb.debian.org/debian {{ ansible_distribution_release }}-backports main
state: present
filename: "{{ ansible_distribution_release }}-backports"
- name: haproxy | update apt cache
apt:
update_cache: yes
cache_valid_time: 86400
- name: haproxy | installation
apt:
name: haproxy
state: present
default_release: "{{ ansible_distribution_release }}-backports"

View File

@@ -0,0 +1,20 @@
---
- name: haproxy | add HAProxy Debian repository key
ansible.builtin.get_url:
url: "{{ haproxy_debian_repo_key_url }}"
dest: /etc/apt/keyrings/haproxy-archive-keyring.gpg
mode: '0644'
- name: haproxy | add HAProxy Debian repository
ansible.builtin.apt_repository:
repo: "deb [signed-by=/etc/apt/keyrings/haproxy-archive-keyring.gpg] {{ haproxy_debian_repo_url }} {{ haproxy_debian_repo_distribution }}-backports-{{ haproxy_version }} {{ haproxy_debian_repo_component }}"
state: present
filename: 'haproxy'
update_cache: yes
- name: haproxy | install HAProxy from HAProxy Debian repo
ansible.builtin.apt:
name: haproxy
state: present
update_cache: yes
default_release: "{{ haproxy_debian_repo_distribution }}-backports-{{ haproxy_version }}"

View File

@@ -1,10 +1,11 @@
---
- name: haproxy | requirements
include_tasks: requirements.yml
- name: haproxy | install from backports
include_tasks: install_from_backports.yml
when: not haproxy_use_debian_repo | bool
- name: haproxy | installation
include_tasks: install.yml
- name: haproxy | install from HAProxy repo
include_tasks: install_from_haproxy.yml
when: haproxy_use_debian_repo | bool
- name: haproxy | configuration
include_tasks: configure.yml