From c6802f992ee3e2ad2d68450608658d971c2b1fd3 Mon Sep 17 00:00:00 2001 From: Alexander Dietrich Date: Sat, 21 May 2022 14:47:31 +0200 Subject: [PATCH] Use Ansible collection for some roles, config updates --- basics.yml | 6 ++--- inventory/group_vars/all.yml | 4 ++-- inventory/host_vars/srv02.yml | 1 - requirements-galaxy.yml | 9 +++---- requirements-github.yml | 10 ++++---- roles/certbot/files/cli.ini | 13 ---------- roles/certbot/files/reload-nginx | 5 ---- roles/certbot/tasks/main.yml | 25 -------------------- roles/error-pages/files/error-pages.conf | 4 ++-- roles/error-pages/files/error-pages/502.html | 4 ++-- roles/error-pages/tasks/main.yml | 4 ++-- roles/website/media/meta/main.yml | 2 +- roles/website/meta/meta/main.yml | 2 +- roles/website/updates/meta/main.yml | 2 +- 14 files changed, 21 insertions(+), 70 deletions(-) delete mode 100644 roles/certbot/files/cli.ini delete mode 100644 roles/certbot/files/reload-nginx delete mode 100644 roles/certbot/tasks/main.yml diff --git a/basics.yml b/basics.yml index 478ee7a..52a800a 100644 --- a/basics.yml +++ b/basics.yml @@ -1,20 +1,20 @@ --- - hosts: ffhh roles: - - basics + - alxndr42.commons.basics - basics-ffhh tags: basics - hosts: nginx roles: - - nginx + - alxndr42.commons.nginx - nginx-ffhh - error-pages tags: nginx - hosts: certbot roles: - - certbot + - alxndr42.commons.certbot tags: certbot - hosts: certsync diff --git a/inventory/group_vars/all.yml b/inventory/group_vars/all.yml index 000c0ff..dc985b7 100644 --- a/inventory/group_vars/all.yml +++ b/inventory/group_vars/all.yml @@ -1,5 +1,5 @@ -ansible_python_interpreter: /usr/bin/python3 - basics_autoupdate_mail: backend@hamburg.freifunk.net +certbot_email: backend@hamburg.freifunk.net + nginx_error_log: "/dev/null error" diff --git a/inventory/host_vars/srv02.yml b/inventory/host_vars/srv02.yml index 75aa1db..c0bb90a 100644 --- a/inventory/host_vars/srv02.yml +++ b/inventory/host_vars/srv02.yml @@ -1,6 +1,5 @@ basics_autoupdate_origins: - o=Node Source,n=${distro_codename} - - o=Prosody,n=${distro_codename} - o=TorProject,n=${distro_codename} media_tls_crt: /etc/letsencrypt/live/media.hamburg.freifunk.net/fullchain.pem diff --git a/requirements-galaxy.yml b/requirements-galaxy.yml index d091cc4..2f90b52 100644 --- a/requirements-galaxy.yml +++ b/requirements-galaxy.yml @@ -1,7 +1,4 @@ --- -- src: alxndr42.basics - name: basics - version: v1.11.0 -- src: alxndr42.nginx - name: nginx - version: v1.4.0 +collections: + - name: alxndr42.commons + version: 1.0.0 diff --git a/requirements-github.yml b/requirements-github.yml index 4baac94..35f21e5 100644 --- a/requirements-github.yml +++ b/requirements-github.yml @@ -1,7 +1,5 @@ --- -- src: https://github.com/alxndr42/ansible-basics.git - name: basics - version: v1.11.0 -- src: https://github.com/alxndr42/ansible-nginx.git - name: nginx - version: v1.4.0 +collections: + - name: https://github.com/alxndr42/ansible-commons.git + type: git + version: v1.0.0 diff --git a/roles/certbot/files/cli.ini b/roles/certbot/files/cli.ini deleted file mode 100644 index c08b252..0000000 --- a/roles/certbot/files/cli.ini +++ /dev/null @@ -1,13 +0,0 @@ -# Because we are using logrotate for greater flexibility, disable the -# internal certbot logrotation. -max-log-backups = 0 - -email = backend@hamburg.freifunk.net -rsa-key-size = 4096 - -authenticator = webroot -webroot-path = /var/www/_acme-challenge - -agree-tos = True -non-interactive = True -text = True diff --git a/roles/certbot/files/reload-nginx b/roles/certbot/files/reload-nginx deleted file mode 100644 index aaaaf79..0000000 --- a/roles/certbot/files/reload-nginx +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -PATH="/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin" - -systemctl reload nginx diff --git a/roles/certbot/tasks/main.yml b/roles/certbot/tasks/main.yml deleted file mode 100644 index f40f37e..0000000 --- a/roles/certbot/tasks/main.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- -- name: install certbot - apt: - name: certbot - cache_valid_time: 86400 - -- name: create webroot directory - file: - path: /var/www/_acme-challenge - state: directory - -- name: copy cli.ini - copy: - src: cli.ini - dest: /etc/letsencrypt/ - -- name: populate service facts - service_facts: - -- name: copy reload-nginx hook - copy: - src: reload-nginx - dest: /etc/letsencrypt/renewal-hooks/post/ - mode: 0755 - when: "'nginx' in services" diff --git a/roles/error-pages/files/error-pages.conf b/roles/error-pages/files/error-pages.conf index aecc17c..248a804 100644 --- a/roles/error-pages/files/error-pages.conf +++ b/roles/error-pages/files/error-pages.conf @@ -1,5 +1,5 @@ -error_page 502 /_error-pages/502.html; +error_page 502 /error-pages/502.html; -location ^~ /_error-pages { +location ^~ /error-pages { root /var/www; } diff --git a/roles/error-pages/files/error-pages/502.html b/roles/error-pages/files/error-pages/502.html index 4788012..c395ba4 100644 --- a/roles/error-pages/files/error-pages/502.html +++ b/roles/error-pages/files/error-pages/502.html @@ -3,8 +3,8 @@ Bad Gateway - + - Bad Gateway Traffic Sign + Bad Gateway Traffic Sign diff --git a/roles/error-pages/tasks/main.yml b/roles/error-pages/tasks/main.yml index d0f5c6a..a19cc02 100644 --- a/roles/error-pages/tasks/main.yml +++ b/roles/error-pages/tasks/main.yml @@ -1,13 +1,13 @@ --- - name: create directory file: - path: /var/www/_error-pages + path: /var/www/error-pages state: directory - name: copy error-pages copy: src: error-pages/ - dest: /var/www/_error-pages/ + dest: /var/www/error-pages/ - name: copy error-pages.conf copy: diff --git a/roles/website/media/meta/main.yml b/roles/website/media/meta/main.yml index 8b662c9..486d44f 100644 --- a/roles/website/media/meta/main.yml +++ b/roles/website/media/meta/main.yml @@ -1,3 +1,3 @@ --- dependencies: - - role: nginx + - role: alxndr42.commons.nginx diff --git a/roles/website/meta/meta/main.yml b/roles/website/meta/meta/main.yml index 8b662c9..486d44f 100644 --- a/roles/website/meta/meta/main.yml +++ b/roles/website/meta/meta/main.yml @@ -1,3 +1,3 @@ --- dependencies: - - role: nginx + - role: alxndr42.commons.nginx diff --git a/roles/website/updates/meta/main.yml b/roles/website/updates/meta/main.yml index 8b662c9..486d44f 100644 --- a/roles/website/updates/meta/main.yml +++ b/roles/website/updates/meta/main.yml @@ -1,3 +1,3 @@ --- dependencies: - - role: nginx + - role: alxndr42.commons.nginx