From 46403950eaa53a000b8a093b0ae47caaec2cc402 Mon Sep 17 00:00:00 2001
From: Giancarlo Razzolini <grazzolini@archlinux.org>
Date: Mon, 10 Feb 2020 11:26:27 -0300
Subject: [PATCH] roles/aurweb: Remove maintenance role from the tasks and add
 the maintenance mode to AUR config

Since the AUR has its own maintenance mode, there is no need for using the
maintenance role, so it was removed. Added a check on the aurweb config file
that checks for the maintenance variable and uses the variable for allowing
the ip address of the person running the playbook to access the AUR.
---
 roles/aurweb/tasks/main.yml      | 10 ----------
 roles/aurweb/templates/config.j2 |  5 +++++
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/roles/aurweb/tasks/main.yml b/roles/aurweb/tasks/main.yml
index efdab44ac..a624bae78 100644
--- a/roles/aurweb/tasks/main.yml
+++ b/roles/aurweb/tasks/main.yml
@@ -1,14 +1,4 @@
 ---
-- name: run maintenance mode
-  include_role:
-    name: maintenance
-  vars:
-    service_name: "site"
-    service_domain: "{{ aurweb_domain }}"
-    service_alternate_domains: []
-    service_nginx_conf: "{{ aurweb_nginx_conf }}"
-  when: maintenance is defined
-
 - name: install required packages
   pacman: name=git,sudo,python-mysql-connector,python-pygit2,python-srcinfo,python-bleach,python-markdown,pyalpm,make,asciidoc,php-apcu,php-apcu-bc state=present
 
diff --git a/roles/aurweb/templates/config.j2 b/roles/aurweb/templates/config.j2
index 8691f73bb..c096f5d2a 100644
--- a/roles/aurweb/templates/config.j2
+++ b/roles/aurweb/templates/config.j2
@@ -4,7 +4,12 @@ user = {{ aurweb_db_user }}
 password = {{ vault_aurweb_db_password }}
 
 [options]
+{% if maintenance is defined and maintenance %}
+enable_maintenance = 1
+maintenance-exceptions = {{ maintenance_remote_machine }}
+{% else %}
 enable-maintenance = 0
+{% endif %}
 localedir = {{ aurweb_dir }}/web/locale/
 cache = {{ aurweb_cache }}
 cache_pkginfo_ttl = {{ aurweb_cache_pkginfo_ttl }}
-- 
GitLab