diff --git a/tasks/main.yml b/tasks/main.yml
index 80dc64649ffc393a4e9c4a575291d3b39509e2db..0fe9ef951782e4863cb876df9d7e64a9d4e08e6b 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -20,14 +20,6 @@
     path: /srv/AKPlanning/AKPlanning/settings_production.py
   register: akplanning_settings
 
-- name: Set the original db host so we can update # noqa 208
-  lineinfile:
-    path: /srv/AKPlanning/AKPlanning/settings_production.py
-    line: "        'HOST': 'localhost',"
-    regexp: "^        'HOST':"
-  when: akplanning_settings.stat.exists
-  notify: restart akplanning
-
 - name: Clone AKPlanning
   git:
     repo: https://gitlab.fachschaften.org/kif/akplanning.git
@@ -83,13 +75,6 @@
     group: django
   notify: restart akplanning
 
-- name: Set the correct db host # noqa 208
-  lineinfile:
-    path: /srv/AKPlanning/AKPlanning/settings_production.py
-    line: "        'HOST': '{{ hostvars[akplanning_mariadb_host]['ansible_default_ipv4']['address'] }}',"
-    regexp: "^        'HOST':"
-  notify: restart akplanning
-
 - name: AKPlanning migrate and stuff
   shell: |
     . /srv/AKPlanning/venv/bin/activate
diff --git a/templates/settings_secrets.py.j2 b/templates/settings_secrets.py.j2
index 572927574e3cc0f75f4da07d0e88f1306883b61b..b0e57beb54cea85b55f2cd3a305cde7c3c8dc69a 100644
--- a/templates/settings_secrets.py.j2
+++ b/templates/settings_secrets.py.j2
@@ -7,3 +7,5 @@ DB_NAME = '{{ akplanning_mariadb_user }}'
 DB_USER = '{{ akplanning_mariadb_user }}'
 
 DB_PASSWORD = '{{ akplanning_mariadb_pass }}'
+
+DB_HOST = '{{ hostvars[akplanning_mariadb_host]['ansible_default_ipv4']['address'] }}'