From b686c6ae9ff18ca1ce8b8e602dc03548cbfa7b31 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 17 Oct 2026 21:23:25 -0700 Subject: Add better encapsulation to ansible roles - Replace a few of the global variables in the host inventory to explicit variables that we pass into the particular roles that need it. - Move slowcgi setup to cgit since that is where it is needed (instead of obsd_httpd) - Rename `acme_client` to `obsd_ssl` to better emphasize it is related to generating ssl certificates on openbsd. - Add support for multiple ssl certificates into `obsd_ssl` by looping over the new role variable it has --- roles/obsd_httpd/defaults/main.yml | 1 + roles/obsd_httpd/handlers/main.yml | 4 ++++ roles/obsd_httpd/tasks/main.yml | 10 +++------- roles/obsd_httpd/templates/httpd.conf.j2 | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 roles/obsd_httpd/handlers/main.yml (limited to 'roles/obsd_httpd') diff --git a/roles/obsd_httpd/defaults/main.yml b/roles/obsd_httpd/defaults/main.yml index f7b6b57..8dda1e9 100644 --- a/roles/obsd_httpd/defaults/main.yml +++ b/roles/obsd_httpd/defaults/main.yml @@ -1 +1,2 @@ obsd_httpd_conf_d: /etc/httpd.d +obsd_httpd_fragments: diff --git a/roles/obsd_httpd/handlers/main.yml b/roles/obsd_httpd/handlers/main.yml new file mode 100644 index 0000000..356bdcb --- /dev/null +++ b/roles/obsd_httpd/handlers/main.yml @@ -0,0 +1,4 @@ +- name: Reload httpd + ansible.builtin.service: + name: httpd + state: reloaded diff --git a/roles/obsd_httpd/tasks/main.yml b/roles/obsd_httpd/tasks/main.yml index 2dd1b30..ef0fd41 100644 --- a/roles/obsd_httpd/tasks/main.yml +++ b/roles/obsd_httpd/tasks/main.yml @@ -13,7 +13,6 @@ owner: root group: wheel mode: "0600" - notify: Reload httpd - name: Ensure all registered httpd fragment files exist ansible.builtin.copy: @@ -23,12 +22,9 @@ owner: root group: wheel mode: "0644" - loop: "{{ httpd_fragments }}" + loop: "{{ obsd_httpd_fragments }}" -- name: Enable httpd and slowcgi +- name: Enable httpd ansible.builtin.service: - name: "{{ item }}" + name: httpd enabled: true - loop: - - httpd - - slowcgi diff --git a/roles/obsd_httpd/templates/httpd.conf.j2 b/roles/obsd_httpd/templates/httpd.conf.j2 index 2825853..2cd2e4a 100644 --- a/roles/obsd_httpd/templates/httpd.conf.j2 +++ b/roles/obsd_httpd/templates/httpd.conf.j2 @@ -1,5 +1,5 @@ types { include "/usr/share/misc/mime.types" } -{% for fragment in httpd_fragments %} +{% for fragment in obsd_httpd_fragments %} include "{{ obsd_httpd_conf_d }}/{{ fragment }}" {% endfor %} -- cgit v1.2.3