diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2026-10-17 21:23:25 -0700 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2026-10-17 21:32:44 -0700 |
| commit | b686c6ae9ff18ca1ce8b8e602dc03548cbfa7b31 (patch) | |
| tree | 2bde43d963e2c8703cf7d39443ac0301cbd332a2 /roles/acme_client | |
| parent | Move playbook vars to the role that uses them (diff) | |
| download | site-configs-b686c6ae9ff18ca1ce8b8e602dc03548cbfa7b31.zip | |
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
Diffstat (limited to 'roles/acme_client')
| -rw-r--r-- | roles/acme_client/defaults/main.yml | 1 | ||||
| -rw-r--r-- | roles/acme_client/tasks/main.yml | 45 | ||||
| -rw-r--r-- | roles/acme_client/templates/acme-client.conf.j2 | 15 | ||||
| -rw-r--r-- | roles/acme_client/templates/httpd.d/acme.conf | 11 |
4 files changed, 0 insertions, 72 deletions
diff --git a/roles/acme_client/defaults/main.yml b/roles/acme_client/defaults/main.yml deleted file mode 100644 index 07c2a4a..0000000 --- a/roles/acme_client/defaults/main.yml +++ /dev/null @@ -1 +0,0 @@ -acme_client_domain: "{{ acme_domain }}" diff --git a/roles/acme_client/tasks/main.yml b/roles/acme_client/tasks/main.yml deleted file mode 100644 index 8b2e95f..0000000 --- a/roles/acme_client/tasks/main.yml +++ /dev/null @@ -1,45 +0,0 @@ -- name: Deploy acme challenge vhost fragment - ansible.builtin.template: - src: httpd.d/acme.conf - dest: "{{ obsd_httpd_conf_d | default('/etc/httpd.d') }}/acme.conf" - owner: root - group: wheel - mode: "0644" - register: acme_client_vhost_config - -- name: Deploy acme-client.conf - ansible.builtin.template: - src: acme-client.conf.j2 - dest: /etc/acme-client.conf - owner: root - group: wheel - mode: "0600" - -- name: Start httpd - ansible.builtin.service: - name: httpd - state: started - when: acme_client_vhost_config is changed # noqa: no-handler - -- name: Reload httpd - ansible.builtin.service: - name: httpd - state: reloaded - when: acme_client_vhost_config is changed # noqa: no-handler - -- name: Generate certificate - ansible.builtin.command: acme-client {{ acme_client_domain }} - args: - creates: "/etc/ssl/{{ acme_client_domain }}.fullchain.pem" - -- name: Add certificate renewal crontab entry - # Implements the example from `man acme-client` - # > A cron(8) job can renew the certificate as necessary. On renewal, - # > httpd(8) is reloaded: - # > - # > ~ * * * * acme-client example.com && rcctl reload httpd - ansible.builtin.cron: - name: "renew {{ acme_client_domain }} certificate" - minute: "~" - user: root - job: "acme-client {{ acme_client_domain }} && rcctl reload httpd" diff --git a/roles/acme_client/templates/acme-client.conf.j2 b/roles/acme_client/templates/acme-client.conf.j2 deleted file mode 100644 index 54036b9..0000000 --- a/roles/acme_client/templates/acme-client.conf.j2 +++ /dev/null @@ -1,15 +0,0 @@ -authority letsencrypt { - api url "https://acme-v02.api.letsencrypt.org/directory" - account key "/etc/acme/letsencrypt-privkey.pem" -} - -authority letsencrypt-staging { - api url "https://acme-staging-v02.api.letsencrypt.org/directory" - account key "/etc/acme/letsencrypt-staging-privkey.pem" -} - -domain "{{ acme_client_domain }}" { - domain key "/etc/ssl/private/{{ acme_client_domain }}.key" - domain full chain certificate "/etc/ssl/{{ acme_client_domain }}.fullchain.pem" - sign with letsencrypt -} diff --git a/roles/acme_client/templates/httpd.d/acme.conf b/roles/acme_client/templates/httpd.d/acme.conf deleted file mode 100644 index 905da28..0000000 --- a/roles/acme_client/templates/httpd.d/acme.conf +++ /dev/null @@ -1,11 +0,0 @@ -server "{{ acme_client_domain }}" { - listen on * port 80 - location "/.well-known/acme-challenge/*" { - root "/acme" - request strip 2 - } - location * { - block return 302 "https://$HTTP_HOST$REQUEST_URI" - } -} - |