2021-07-28 18:28:22 +02:00
|
|
|
---
|
|
|
|
- name: "database: Datenbank anlegen"
|
|
|
|
postgresql_db:
|
|
|
|
name: "{{ zammad_database_name }}"
|
|
|
|
encoding: UTF8
|
|
|
|
template: template0
|
|
|
|
become: true
|
|
|
|
become_user: postgres
|
|
|
|
delegate_to: "{{ database_host }}"
|
2021-10-13 08:26:16 +02:00
|
|
|
register: database_created
|
2021-07-28 18:28:22 +02:00
|
|
|
|
|
|
|
- name: "database: Benutzer einrichten"
|
|
|
|
postgresql_user:
|
|
|
|
name: "{{ zammad_database_user }}"
|
|
|
|
password: "{{ zammad_database_password }}"
|
|
|
|
db: "{{ zammad_database_name }}"
|
|
|
|
become: true
|
|
|
|
become_user: postgres
|
|
|
|
delegate_to: "{{ database_host }}"
|
|
|
|
|
|
|
|
- name: "database: Konfiguration kopieren"
|
|
|
|
template:
|
|
|
|
src: database.yml.j2
|
|
|
|
dest: "{{ zammad_database_configuration }}"
|
|
|
|
|
|
|
|
- name: "database: Stoppe Service"
|
|
|
|
service:
|
|
|
|
name: zammad
|
|
|
|
state: stopped
|
|
|
|
register: unused_disable
|
|
|
|
failed_when: "unused_disable is failed and ('find' not in unused_disable.msg and 'found' not in unused_disable.msg)"
|
|
|
|
|
2021-10-13 08:26:16 +02:00
|
|
|
- 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
|
|
|
|
|
2021-07-28 18:28:22 +02:00
|
|
|
- name: "database: Führe Migrationen aus"
|
|
|
|
shell: "RAILS_ENV=production rbenv exec bundle exec rake db:migrate"
|
|
|
|
args:
|
|
|
|
chdir: "{{ zammad_home }}"
|
|
|
|
become: true
|
|
|
|
become_user: "{{ zammad_user }}"
|
|
|
|
|
|
|
|
- name: "database: Führe Seeds aus"
|
|
|
|
shell: "RAILS_ENV=production rbenv exec bundle exec rake db:seed"
|
|
|
|
args:
|
|
|
|
chdir: "{{ zammad_home }}"
|
|
|
|
become: true
|
|
|
|
become_user: "{{ zammad_user }}"
|
2021-10-13 08:26:16 +02:00
|
|
|
when: database_created.changed
|
2021-07-28 18:28:22 +02:00
|
|
|
|
|
|
|
- name: "database: Precompile Assets"
|
|
|
|
shell: "RAILS_ENV=production rbenv exec bundle exec rake assets:precompile"
|
|
|
|
args:
|
|
|
|
chdir: "{{ zammad_home }}"
|
|
|
|
become: true
|
|
|
|
become_user: "{{ zammad_user }}"
|