Compare commits

..

1 Commits

Author SHA1 Message Date
uumas
c06b228be6 Add systemd role for restarting multiple services in same transaction 2026-03-11 22:15:34 +02:00
11 changed files with 2 additions and 67 deletions

View File

@@ -2,7 +2,7 @@
namespace: uumas
name: general
description: General roles
version: 0.5.20
version: 0.5.17
readme: README.md
authors:
- uumas

View File

@@ -1,14 +1,4 @@
---
- name: Set sysctl udp buffer sizes for caddy
ansible.posix.sysctl:
name: "{{ item.key }}"
value: "{{ item.value }}"
state: present
reload: true
with_dict:
net.core.rmem_max: "7500000"
net.core.wmem_max: "7500000"
- name: Ensure legacy caddy apt repository not present
ansible.builtin.file:
path: /etc/apt/sources.list.d/caddy-stable.list

View File

@@ -1,9 +0,0 @@
Adds systemd-related notifiable handlers
- Reload systemd daemon
- Reloads all systemd unit files
- Apply systemd unit restarts
- Restarts multiple systemd units in a single transaction
- Units to be restarted are defined in the `systemd_restart_units` variable of type list
- The variable should be set using `ansible.builtin.set_fact`, with `# noqa: var-naming[no-role-prefix]`
- The list must not be overridden, but appended (`systemd_restart_units: "{{ systemd_restart_units + ['restartme.service'] }}"`

View File

@@ -9,6 +9,6 @@
changed_when: true
- name: Reset systemd restart units
listen: Apply systemd unit restarts
listen: Apply systemd units restart
ansible.builtin.set_fact:
systemd_restart_units: []

View File

@@ -1 +0,0 @@
Adds a systemd socket for a service

View File

@@ -1,2 +0,0 @@
---
systemd_socket_requires: []

View File

@@ -1,6 +0,0 @@
---
- name: Restart socket {{ systemd_socket_name }}
ansible.builtin.set_fact:
systemd_restart_units: "{{ systemd_restart_units + [systemd_socket_name ~ '.socket'] }}" # noqa: var-naming[no-role-prefix]
changed_when: true
notify: Apply systemd unit restarts

View File

@@ -1,16 +0,0 @@
---
argument_specs:
main:
description:
- Adds a systemd socket for a service
options:
systemd_socket_name:
description: Name of the socket. The socket will be created at /run/<systemd_socket_name>.sock
type: str
required: true
systemd_socket_requires:
description: List of units this socket depends on.
type: list
required: false
default: []
elements: str

View File

@@ -1,3 +0,0 @@
---
dependencies:
- role: systemd

View File

@@ -1,9 +0,0 @@
---
- name: Socket {{ systemd_socket_name }}
ansible.builtin.template:
src: socket.j2
dest: /etc/systemd/system/{{ systemd_socket_name }}.socket
mode: "0644"
notify:
- Reload systemd daemon
- Restart socket {{ systemd_socket_name }}

View File

@@ -1,9 +0,0 @@
# {{ ansible_managed }}
[Unit]
Description={{ systemd_socket_name }} socket
{% for item in systemd_socket_requires %}
Requires={{ item }}
{% endfor %}
[Socket]
ListenStream=/run/{{ systemd_socket_name }}.sock