- Abhängigkeit auf Erstellung der Datenbank

- Füge weitere Tags ein
This commit is contained in:
phil 2021-10-13 08:26:16 +02:00
parent 3ede350f4d
commit 6a1f2228e0
2 changed files with 12 additions and 6 deletions

View file

@ -7,6 +7,7 @@
become: true become: true
become_user: postgres become_user: postgres
delegate_to: "{{ database_host }}" delegate_to: "{{ database_host }}"
register: database_created
- name: "database: Benutzer einrichten" - name: "database: Benutzer einrichten"
postgresql_user: postgresql_user:
@ -29,6 +30,14 @@
register: unused_disable register: unused_disable
failed_when: "unused_disable is failed and ('find' not in unused_disable.msg and 'found' not in unused_disable.msg)" 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" - name: "database: Führe Migrationen aus"
shell: "RAILS_ENV=production rbenv exec bundle exec rake db:migrate" shell: "RAILS_ENV=production rbenv exec bundle exec rake db:migrate"
args: args:
@ -42,7 +51,7 @@
chdir: "{{ zammad_home }}" chdir: "{{ zammad_home }}"
become: true become: true
become_user: "{{ zammad_user }}" become_user: "{{ zammad_user }}"
when: zammad_database_configured.stat.exists == False when: database_created.changed
- name: "database: Precompile Assets" - name: "database: Precompile Assets"
shell: "RAILS_ENV=production rbenv exec bundle exec rake assets:precompile" shell: "RAILS_ENV=production rbenv exec bundle exec rake assets:precompile"

View file

@ -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: packages.yml
- import_tasks: locales.yml - import_tasks: locales.yml
- import_tasks: user.yml - import_tasks: user.yml
- import_tasks: zammad.yml - import_tasks: zammad.yml
tags: zammad tags: zammad
- import_tasks: ruby.yml - import_tasks: ruby.yml
tags: ruby
- import_tasks: database.yml - import_tasks: database.yml
tags: database
- import_tasks: syslog.yml - import_tasks: syslog.yml
- import_tasks: webserver.yml - import_tasks: webserver.yml
- import_tasks: systemd.yml - import_tasks: systemd.yml