Skip to content

Commit cd61710

Browse files
committed
Use systemd socket activation for Foreman
1 parent df8114a commit cd61710

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

src/roles/foreman/defaults/main.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ foreman_database_ssl_ca: # noqa: no-empty-defaults
1212
foreman_database_ssl_ca_path: /etc/foreman/db-ca.crt
1313

1414
foreman_name: "{{ ansible_facts['fqdn'] }}"
15+
foreman_listen_stream: 127.0.0.1:3000
1516
foreman_url: "http://{{ ansible_facts['fqdn'] }}:3000"
1617

1718
# Puma threads calculation:

src/roles/foreman/tasks/main.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@
100100
- Restart foreman
101101
- Restart dynflow-sidekiq@
102102

103+
- name: Deploy Foreman socket
104+
ansible.builtin.template:
105+
src: foreman.socket.j2
106+
dest: /etc/systemd/system/foreman.socket
107+
mode: '0644'
108+
103109
- name: Deploy Foreman Container
104110
containers.podman.podman_container:
105111
name: "foreman"
@@ -130,6 +136,8 @@
130136
FOREMAN_ENABLED_PLUGINS: "{{ foreman_plugins | join(' ') }}"
131137
quadlet_options:
132138
- |
139+
[Unit]
140+
Requires=foreman.socket
133141
[Install]
134142
WantedBy=default.target foreman.target
135143
[Unit]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[Unit]
2+
Description=Foreman socket
3+
4+
[Socket]
5+
ListenStream={{ foreman_listen_stream }}
6+
7+
[Install]
8+
WantedBy=sockets.target

0 commit comments

Comments
 (0)