Initial commit

This commit is contained in:
ansible
2026-08-04 22:15:56 +02:00
committed by pulsar
commit e2a247680f
8 changed files with 408 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
---
# tasks file for haproxy
- name: Install acme.sh
ansible.builtin.apt:
name: acme.sh
become: true
- name: Execute acme.sh commands
ansible.builtin.command:
argv: "{{ item.command }}"
creates: "{{ item.must_present | default(omit) }}"
removes: "{{ item.must_absent | default(omit) }}"
become: true
loop: "{{ haproxy_acmesh }}"
environment: "{{ item.env }}"
+59
View File
@@ -0,0 +1,59 @@
---
# tasks file for haproxy
- name: Install packages
ansible.builtin.apt:
name:
- haproxy
- rsync
- sudo
become: true
- name: Make dhparams.pem
community.crypto.openssl_dhparam:
path: "{{ haproxy_dhparams_path }}"
size: 2048
owner: root
group: root
mode: u=rw,g=r,o=r
become: true
- name: Deploy error files
ansible.posix.synchronize:
src: "{{ haproxy_errorfiles_src }}"
dest: "{{ haproxy_errorfiles_dst }}"
recursive: true
rsync_opts:
- "--chmod=u=rwX,g=rX,o=rX"
- "--chown=root:root"
- "--exclude=.git"
- "--exclude=.gitignore"
- "--exclude=LICENSE"
- "--exclude=README.md"
when: haproxy_errorfiles_src | length > 0
become: true
notify: Restart haproxy.service
- name: Create certificates path
ansible.builtin.file:
path: "{{ haproxy_certs_path }}"
owner: root
group: root
mode: u=rwX,g=,o=
state: directory
- name: Import tasks to manage certificates with acme.sh
ansible.builtin.import_tasks:
file: acmesh.yml
when: haproxy_acmesh | length > 0
- name: Deploy haproxy.cfg
ansible.builtin.template:
src: haproxy.cfg.j2
dest: /etc/haproxy/haproxy.cfg
owner: root
group: root
mode: u=rw,g=r,o=r
validate: haproxy -f %s -c
become: true
notify: Restart haproxy.service