2021-07-28 18:28:22 +02:00
|
|
|
---
|
2022-06-21 15:29:06 +02:00
|
|
|
- name: "database | Datenbank anlegen"
|
2023-03-19 01:12:43 +01:00
|
|
|
community.postgresql.postgresql_db:
|
2021-07-28 18:28:22 +02:00
|
|
|
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
|
|
|
|
2022-06-21 15:29:06 +02:00
|
|
|
- name: "database | Benutzer einrichten"
|
2023-03-19 01:12:43 +01:00
|
|
|
community.postgresql.postgresql_user:
|
2021-07-28 18:28:22 +02:00
|
|
|
name: "{{ zammad_database_user }}"
|
|
|
|
password: "{{ zammad_database_password }}"
|
|
|
|
db: "{{ zammad_database_name }}"
|
|
|
|
become: true
|
|
|
|
become_user: postgres
|
|
|
|
delegate_to: "{{ database_host }}"
|
|
|
|
|
2022-06-21 15:29:06 +02:00
|
|
|
- name: "database | Konfiguration kopieren"
|
2023-03-19 01:12:43 +01:00
|
|
|
ansible.builtin.template:
|
2021-07-28 18:28:22 +02:00
|
|
|
src: database.yml.j2
|
|
|
|
dest: "{{ zammad_database_configuration }}"
|
2021-11-02 17:05:45 +01:00
|
|
|
owner: "{{ zammad_user }}"
|
|
|
|
group: "{{ zammad_user }}"
|
2023-03-19 01:12:43 +01:00
|
|
|
mode: "0600"
|
2021-07-28 18:28:22 +02:00
|
|
|
|
2022-06-21 15:29:06 +02:00
|
|
|
- name: "database | Stoppe Service"
|
2023-03-19 01:12:43 +01:00
|
|
|
ansible.builtin.service:
|
2021-07-28 18:28:22 +02:00
|
|
|
name: zammad
|
|
|
|
state: stopped
|
|
|
|
register: unused_disable
|
2021-10-13 08:38:42 +02:00
|
|
|
changed_when: false
|
2021-07-28 18:28:22 +02:00
|
|
|
failed_when: "unused_disable is failed and ('find' not in unused_disable.msg and 'found' not in unused_disable.msg)"
|
|
|
|
|
2022-06-21 15:29:06 +02:00
|
|
|
- name: "database | Führe Migrationen aus"
|
2023-03-19 01:12:43 +01:00
|
|
|
ansible.builtin.shell: "rbenv exec bundle exec rake db:migrate"
|
2021-07-28 18:28:22 +02:00
|
|
|
args:
|
|
|
|
chdir: "{{ zammad_home }}"
|
|
|
|
become: true
|
|
|
|
become_user: "{{ zammad_user }}"
|
2021-11-27 19:49:28 +01:00
|
|
|
environment:
|
|
|
|
RAILS_ENV: production
|
2021-07-28 18:28:22 +02:00
|
|
|
|
2022-06-21 15:29:06 +02:00
|
|
|
- name: "database | Führe Seeds aus"
|
2023-03-19 01:12:43 +01:00
|
|
|
ansible.builtin.shell: "rbenv exec bundle exec rake db:seed"
|
2021-07-28 18:28:22 +02:00
|
|
|
args:
|
|
|
|
chdir: "{{ zammad_home }}"
|
|
|
|
become: true
|
|
|
|
become_user: "{{ zammad_user }}"
|
2021-11-27 19:49:28 +01:00
|
|
|
environment:
|
|
|
|
RAILS_ENV: production
|
2021-10-13 08:26:16 +02:00
|
|
|
when: database_created.changed
|
2021-07-28 18:28:22 +02:00
|
|
|
|
2022-06-21 15:29:06 +02:00
|
|
|
- name: "database | Precompile Assets"
|
2023-03-19 01:12:43 +01:00
|
|
|
ansible.builtin.shell: "rbenv exec bundle exec rake assets:precompile"
|
2021-07-28 18:28:22 +02:00
|
|
|
args:
|
|
|
|
chdir: "{{ zammad_home }}"
|
|
|
|
become: true
|
|
|
|
become_user: "{{ zammad_user }}"
|
2021-11-27 19:49:28 +01:00
|
|
|
environment:
|
|
|
|
RAILS_ENV: production
|
2022-06-21 15:29:06 +02:00
|
|
|
|
|
|
|
- name: "database | Synchronisiere Locales"
|
2023-03-19 01:12:43 +01:00
|
|
|
ansible.builtin.shell: rbenv exec bundle exec rails r "Locale.sync"
|
2022-06-21 15:29:06 +02:00
|
|
|
args:
|
|
|
|
chdir: "{{ zammad_home }}"
|
|
|
|
become: true
|
|
|
|
become_user: "{{ zammad_user }}"
|
|
|
|
environment:
|
|
|
|
RAILS_ENV: production
|
|
|
|
|
|
|
|
- name: "database | Synchronisiere Translations"
|
2023-03-19 01:12:43 +01:00
|
|
|
ansible.builtin.shell: rbenv exec bundle exec rails r "Translation.sync"
|
2022-06-21 15:29:06 +02:00
|
|
|
args:
|
|
|
|
chdir: "{{ zammad_home }}"
|
|
|
|
become: true
|
|
|
|
become_user: "{{ zammad_user }}"
|
|
|
|
environment:
|
|
|
|
RAILS_ENV: production
|