diff options
| author | Jan Tuomi <jan@jantuomi.fi> | 2025-10-11 18:33:51 +0300 |
|---|---|---|
| committer | Jan Tuomi <jan@jantuomi.fi> | 2025-10-11 18:33:51 +0300 |
| commit | 9105c2d8936b0256e5aa3068fbeb7cc440144968 (patch) | |
| tree | 063407f233bb5e3775075bbd5270f314ec418e55 /tasks | |
| parent | dbfa9c70b0480c209678090bf62f2c72d68f5264 (diff) | |
Refactor ingress routing
Diffstat (limited to 'tasks')
| -rw-r--r-- | tasks/jail_ingress.yml | 39 |
1 files changed, 2 insertions, 37 deletions
diff --git a/tasks/jail_ingress.yml b/tasks/jail_ingress.yml index ff6e7d3..ab95a71 100644 --- a/tasks/jail_ingress.yml +++ b/tasks/jail_ingress.yml @@ -5,36 +5,9 @@ - { jail: ingress, package: py311-certbot-nginx } include_tasks: pkg_jail_install.yml -- name: Create static sites log dir - file: - path: /usr/local/jails/containers/ingress/var/log/nginx/{{ item }} - state: directory - owner: root - group: wheel - mode: "0755" - loop: "{{ static_sites | map(attribute='site') | unique }}" - -- name: Create access.log for static sites - file: - path: /usr/local/jails/containers/ingress/var/log/nginx/{{ item }}/access.log - state: touch - owner: root - group: wheel - mode: "0644" - loop: "{{ static_sites | map(attribute='site') | unique }}" - -- name: Create error.log for static sites - file: - path: /usr/local/jails/containers/ingress/var/log/nginx/{{ item }}/error.log - state: touch - owner: root - group: wheel - mode: "0644" - loop: "{{ static_sites | map(attribute='site') | unique }}" - - name: Generate LetsEncrypt certs shell: jexec ingress certbot certonly --nginx -n -m jan@jantuomi.fi --agree-tos -d {{ item }} - loop: "{{ static_sites | selectattr('tls') | map(attribute='host') }}" + loop: "{{ ingress_routes | map(attribute='host') | unique }}" # It's important to run this after generating certs, because nginx.conf refers to files # generated by certbot. Certbot will fail validation if nginx.conf is configured too early. @@ -47,12 +20,6 @@ mode: "0644" register: nginx_conf -- name: Copy over static HTML - ansible.posix.synchronize: - src: "{{ item.value.rstrip('/') + '/' }}" - dest: /usr/local/jails/containers/ingress/usr/local/www/{{ item.key }} - loop: "{{ static_site_dirs | dict2items }}" - - name: Check if nginx is enabled shell: service -j ingress nginx status changed_when: false @@ -89,9 +56,7 @@ group: wheel mode: "0644" vars: - # comma-separated list of sites - items_list: "{{ static_sites + jails }}" - items: "{{ items_list | selectattr('tls') | map(attribute='host') }}" + tls_hosts: "{{ ingress_routes | map(attribute='host') | unique }}" register: jail_ingress_etc_crontab - name: Restart cron |
