From 5027e775341585990f862e10d975c81789b55705 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 7 Feb 2020 13:57:03 +0000 Subject: [PATCH] Have yourls redirect root to admin page I keep forgetting this is a thing and thinking it's broken --- ansible/roles/docker/files/yourls/docker-compose.yml | 3 ++- ansible/roles/docker/files/yourls/index.html | 8 ++++++++ ansible/roles/docker/tasks/yourls.yml | 11 ++++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 ansible/roles/docker/files/yourls/index.html diff --git a/ansible/roles/docker/files/yourls/docker-compose.yml b/ansible/roles/docker/files/yourls/docker-compose.yml index 01e766e..08680b3 100644 --- a/ansible/roles/docker/files/yourls/docker-compose.yml +++ b/ansible/roles/docker/files/yourls/docker-compose.yml @@ -13,13 +13,14 @@ services: - YOURLS_USER=jake - YOURLS_PASS={{ yourls.user_password }} - YOURLS_SITE=https://go.theorangeone.net + volumes: + - ./index.html:/var/www/html/index.html labels: - "traefik.enable=true" - "traefik.http.routers.yourls.rule=Host(`go.theorangeone.net`)" - "traefik.http.routers.yourls.tls=true" - "traefik.http.routers.yourls.tls.certresolver=le" - mysql: image: linuxserver/mariadb:110.4.11mariabionic-ls47 environment: diff --git a/ansible/roles/docker/files/yourls/index.html b/ansible/roles/docker/files/yourls/index.html new file mode 100644 index 0000000..8f01220 --- /dev/null +++ b/ansible/roles/docker/files/yourls/index.html @@ -0,0 +1,8 @@ + + + + + +

Redirecting to admin...

+ + diff --git a/ansible/roles/docker/tasks/yourls.yml b/ansible/roles/docker/tasks/yourls.yml index 92d1967..7e2e421 100644 --- a/ansible/roles/docker/tasks/yourls.yml +++ b/ansible/roles/docker/tasks/yourls.yml @@ -21,6 +21,15 @@ become: true become_user: root +- name: Install yourls index + template: + src: files/yourls/index.html + dest: "/opt/yourls/index.html" + mode: "{{ docker_compose_file_mask }}" + register: config_file + become: true + become_user: root + - name: Cycle yourls container docker_compose: project_src: /opt/yourls @@ -28,7 +37,7 @@ remove_orphans: true remove_volumes: true state: "{{ item }}" - when: compose_file.changed + when: compose_file.changed or config_file.changed loop: - absent - present