From cd8f20852ec7186cc1461e486d7c45abfd8b66ec Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Tue, 28 May 2024 13:23:40 +0200 Subject: [PATCH] dokuwiki: use common nginx role Also get version from NetBox. --- roles/dokuwiki/files/default.conf | 11 ----- roles/dokuwiki/tasks/main.yml | 11 +---- roles/dokuwiki/tasks/nginx.yml | 42 ------------------- ...fri.uni-lj.si.conf.j2 => dokuwiki.conf.j2} | 0 setup.yml | 3 +- 5 files changed, 4 insertions(+), 63 deletions(-) delete mode 100644 roles/dokuwiki/files/default.conf delete mode 100644 roles/dokuwiki/tasks/nginx.yml rename roles/dokuwiki/templates/{doku.fri.uni-lj.si.conf.j2 => dokuwiki.conf.j2} (100%) diff --git a/roles/dokuwiki/files/default.conf b/roles/dokuwiki/files/default.conf deleted file mode 100644 index db3420b..0000000 --- a/roles/dokuwiki/files/default.conf +++ /dev/null @@ -1,11 +0,0 @@ -# Handle .well-known for all domains. -server { - listen 80 default_server; - listen [::]:80 default_server; - location /.well-known/ { - alias /srv/http/.well-known/; - } - location / { - return 301 https://$host$request_uri; - } -} diff --git a/roles/dokuwiki/tasks/main.yml b/roles/dokuwiki/tasks/main.yml index a92e811..643dcf6 100644 --- a/roles/dokuwiki/tasks/main.yml +++ b/roles/dokuwiki/tasks/main.yml @@ -1,10 +1,3 @@ -- name: Set dokuwiki version - set_fact: - dokuwiki_version: 2024-02-06a - -- name: Set up nginx - import_tasks: nginx.yml - - name: Set up PHP import_tasks: php.yml @@ -51,6 +44,6 @@ - name: Create nginx site template: - dest: /etc/nginx/http.d/doku.fri.uni-lj.si.conf - src: doku.fri.uni-lj.si.conf.j2 + dest: /etc/nginx/http.d/dokuwiki.conf + src: dokuwiki.conf.j2 notify: reload nginx diff --git a/roles/dokuwiki/tasks/nginx.yml b/roles/dokuwiki/tasks/nginx.yml deleted file mode 100644 index 3378611..0000000 --- a/roles/dokuwiki/tasks/nginx.yml +++ /dev/null @@ -1,42 +0,0 @@ -- name: Enable community package repo - lineinfile: - path: /etc/apk/repositories - regexp: '^# *(http.*/v[^/]*/community)' - line: '\1' - backrefs: yes - -- name: Install packages - package: - name: certbot,nginx - -- name: Create HTTP server directories - file: - path: /srv/http/.well-known - recurse: true - state: directory - owner: nginx - group: nginx - -- name: Set up default HTTP server - copy: - dest: /etc/nginx/http.d - src: default.conf - -- name: Enable nginx service - service: - name: nginx - enabled: true - state: started - -- name: Get LE certificate - command: - cmd: certbot certonly --non-interactive --agree-tos --register-unsafely-without-email --webroot --webroot-path /srv/http -d doku.fri.uni-lj.si - creates: '/etc/letsencrypt/renewal/doku.fri.uni-lj.si.conf' - -- name: Enable certbot renewal - cron: - name: "certbot renew" - job: "certbot renew --quiet" - user: root - hour: "2,14" - minute: "18" diff --git a/roles/dokuwiki/templates/doku.fri.uni-lj.si.conf.j2 b/roles/dokuwiki/templates/dokuwiki.conf.j2 similarity index 100% rename from roles/dokuwiki/templates/doku.fri.uni-lj.si.conf.j2 rename to roles/dokuwiki/templates/dokuwiki.conf.j2 diff --git a/setup.yml b/setup.yml index b2a8c3a..2d5b235 100644 --- a/setup.yml +++ b/setup.yml @@ -1,7 +1,7 @@ - hosts: '*' + gather_facts: false roles: - facts - gather_facts: false - hosts: ceph-* roles: @@ -18,6 +18,7 @@ - hosts: doku roles: - alpine + - nginx - dokuwiki - hosts: netbox