Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions tasks/acl.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
# tasks file
---
- name: acl | create directories

Check warning on line 3 in tasks/acl.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.file:
path: "{{ item.dest | dirname }}"
path: "{{ acl_file.dest | dirname }}"
state: directory
owner: "{{ item.owner | default('root') }}"
group: "{{ item.group | default('root') }}"
owner: "{{ acl_file.owner | default('root') }}"
group: "{{ acl_file.group | default('root') }}"
mode: '0750'
with_items: "{{ haproxy_acl_files }}"
loop: "{{ haproxy_acl_files }}"
loop_control:
loop_var: acl_file
tags:
- haproxy-acl-create-directories

- name: acl | update files

Check warning on line 16 in tasks/acl.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.template:
src: etc/haproxy/acl.j2
dest: "{{ item.dest }}"
owner: "{{ item.owner | default('root') }}"
group: "{{ item.group | default('root') }}"
mode: "{{ item.mode | default('0640') }}"
with_items: "{{ haproxy_acl_files }}"
dest: "{{ acl_file.dest }}"
owner: "{{ acl_file.owner | default('root') }}"
group: "{{ acl_file.group | default('root') }}"
mode: "{{ acl_file.mode | default('0640') }}"
loop: "{{ haproxy_acl_files }}"
loop_control:
loop_var: acl_file
notify: restart haproxy
tags:
- haproxy-acl-update-files
36 changes: 21 additions & 15 deletions tasks/certificates.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,42 @@
# tasks file
---
- name: certificates | create directories

Check warning on line 3 in tasks/certificates.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.file:
path: "{{ item.dest | dirname }}"
path: "{{ ssl_map.dest | dirname }}"
state: directory
owner: "{{ item.owner | default('root') }}"
group: "{{ item.group | default('root') }}"
owner: "{{ ssl_map.owner | default('root') }}"
group: "{{ ssl_map.group | default('root') }}"
mode: '0750'
with_items: "{{ haproxy_ssl_map }}"
when: item.state is undefined or item.state == 'present'
loop: "{{ haproxy_ssl_map }}"
loop_control:
loop_var: ssl_map
when: ssl_map.state is undefined or ssl_map.state == 'present'
tags:
- haproxy-certificates-create-directories

- name: certificates | copy files

Check warning on line 17 in tasks/certificates.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: "{{ item.owner | default('root') }}"
group: "{{ item.group | default('root') }}"
mode: "{{ item.mode | default('0640') }}"
with_items: "{{ haproxy_ssl_map }}"
when: item.state is undefined or item.state == 'present'
src: "{{ ssl_map.src }}"
dest: "{{ ssl_map.dest }}"
owner: "{{ ssl_map.owner | default('root') }}"
group: "{{ ssl_map.group | default('root') }}"
mode: "{{ ssl_map.mode | default('0640') }}"
loop: "{{ haproxy_ssl_map }}"
loop_control:
loop_var: ssl_map
when: ssl_map.state is undefined or ssl_map.state == 'present'
notify: restart haproxy
tags:
- haproxy-certificates-copy-files

- name: certificates | remove files

Check warning on line 32 in tasks/certificates.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.file:
path: "{{ item.dest }}"
path: "{{ ssl_map.dest }}"
state: absent
with_items: "{{ haproxy_ssl_map }}"
when: item.state is defined and item.state == 'absent'
loop: "{{ haproxy_ssl_map }}"
loop_control:
loop_var: ssl_map
when: ssl_map.state is defined and ssl_map.state == 'absent'
notify: restart haproxy
tags:
- haproxy-certificates-remove-files
8 changes: 5 additions & 3 deletions tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
---
- name: install | dependencies
ansible.builtin.apt:
name: "{{ item.name }}"
state: "{{ item.state }}"
with_items: "{{ haproxy_dependencies }}"
name: "{{ dep.name }}"
state: "{{ dep.state }}"
loop: "{{ haproxy_dependencies }}"
loop_control:
loop_var: dep
tags:
- haproxy-install-dependencies

Expand Down
14 changes: 9 additions & 5 deletions tasks/repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,22 @@

- name: repository | cleanup
ansible.builtin.file:
path: "{{ item }}"
path: "{{ repo_path }}"
state: absent
with_items: "{{ haproxy_repository_files_absent }}"
loop: "{{ haproxy_repository_files_absent }}"
loop_control:
loop_var: repo_path
tags:
- haproxy-repository-cleanup

- name: repository | add
ansible.builtin.apt_repository:
repo: "{{ item.type }} {{ item.url }} {{ item.component }}"
state: "{{ item.state | default('present') }}"
repo: "{{ repo.type }} {{ repo.url }} {{ repo.component }}"
state: "{{ repo.state | default('present') }}"
update_cache: true
mode: '0644'
with_items: "{{ haproxy_repositories }}"
loop: "{{ haproxy_repositories }}"
loop_control:
loop_var: repo
tags:
- haproxy-repository-add
2 changes: 1 addition & 1 deletion templates/usr/local/bin/haproxy-letsencrypt-ocsp-deploy.j2
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ done

find "{{ haproxy_global_crt_base }}" -mindepth 1 -name "*.ocsp" -mtime +0 -delete;

{% if ansible_service_mgr == 'systemd' %}
{% if ansible_facts['service_mgr'] == 'systemd' %}
systemctl reload haproxy;
{% else %}
service haproxy reload;
Expand Down
6 changes: 3 additions & 3 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ haproxy_keyring_id: 3D653970FBAB0A890E4E4E9A0F14D8B0CF4EFE96
haproxy_keyring_dst: /usr/share/keyrings/haproxy.gpg
haproxy_repositories:
- type: "deb [signed-by={{ haproxy_keyring_dst }}]"
url: "https://ppa.launchpadcontent.net/vbernat/haproxy-{{ haproxy_version }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }}"
url: "https://ppa.launchpadcontent.net/vbernat/haproxy-{{ haproxy_version }}/{{ ansible_facts['distribution'] | lower }} {{ ansible_facts['distribution_release'] }}"
component: main
_haproxy_version_sources_list_d: "{{ (haproxy_version | string).split('.') | join('_') }}"
haproxy_repository_files_absent:
- "/etc/apt/sources.list.d/ppa_vbernat_haproxy_{{ _haproxy_version_sources_list_d }}_{{ ansible_distribution_release }}.list"
- "/etc/apt/sources.list.d/ppa_vbernat_haproxy_{{ _haproxy_version_sources_list_d }}_{{ ansible_distribution_release }}.list.save"
- "/etc/apt/sources.list.d/ppa_vbernat_haproxy_{{ _haproxy_version_sources_list_d }}_{{ ansible_facts['distribution_release'] }}.list"
- "/etc/apt/sources.list.d/ppa_vbernat_haproxy_{{ _haproxy_version_sources_list_d }}_{{ ansible_facts['distribution_release'] }}.list.save"

haproxy_dependencies_pre:
- software-properties-common
Expand Down
Loading