From 6a1f2228e066f25eef95d276b509d87be99d261d Mon Sep 17 00:00:00 2001 From: phil Date: Wed, 13 Oct 2021 08:26:16 +0200 Subject: [PATCH] =?UTF-8?q?-=20Abh=C3=A4ngigkeit=20auf=20Erstellung=20der?= =?UTF-8?q?=20Datenbank=20-=20F=C3=BCge=20weitere=20Tags=20ein?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tasks/database.yml | 11 ++++++++++- tasks/main.yml | 7 ++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tasks/database.yml b/tasks/database.yml index 0f22f98..99792e7 100644 --- a/tasks/database.yml +++ b/tasks/database.yml @@ -7,6 +7,7 @@ become: true become_user: postgres delegate_to: "{{ database_host }}" + register: database_created - name: "database: Benutzer einrichten" postgresql_user: @@ -29,6 +30,14 @@ register: unused_disable failed_when: "unused_disable is failed and ('find' not in unused_disable.msg and 'found' not in unused_disable.msg)" +- name: "database: Befülle Datenbank" + shell: "RAILS_ENV=production rbenv exec bundle exec rake db:create" + args: + chdir: "{{ zammad_home }}" + become: true + become_user: "{{ zammad_user }}" + when: database_created.changed + - name: "database: Führe Migrationen aus" shell: "RAILS_ENV=production rbenv exec bundle exec rake db:migrate" args: @@ -42,7 +51,7 @@ chdir: "{{ zammad_home }}" become: true become_user: "{{ zammad_user }}" - when: zammad_database_configured.stat.exists == False + when: database_created.changed - name: "database: Precompile Assets" shell: "RAILS_ENV=production rbenv exec bundle exec rake assets:precompile" diff --git a/tasks/main.yml b/tasks/main.yml index 49eaaae..1813c3b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,15 +1,12 @@ -- name: "Prüfe vorhandene Datenbank-Konfiguration" - stat: - path: "{{ zammad_database_configuration }}" - register: zammad_database_configured - - import_tasks: packages.yml - import_tasks: locales.yml - import_tasks: user.yml - import_tasks: zammad.yml tags: zammad - import_tasks: ruby.yml + tags: ruby - import_tasks: database.yml + tags: database - import_tasks: syslog.yml - import_tasks: webserver.yml - import_tasks: systemd.yml