Cleanup role

This commit is contained in:
phil 2023-12-22 08:46:29 +01:00
parent 8f72c4bd68
commit 62c1026254
15 changed files with 1 additions and 237 deletions

View file

@ -1 +0,0 @@
-Dlog4j2.formatMsgNoLookups=true

View file

@ -1,10 +0,0 @@
--- app/models/channel/email_build.rb.orig 2021-07-27 18:03:57.295467567 +0200
+++ app/models/channel/email_build.rb 2021-07-27 18:04:20.705471697 +0200
@@ -62,6 +62,7 @@
# generate plain part
attr[:body] = attr[:body].html2text
+ html_alternative = false
end
# add plain text part

View file

@ -1,8 +0,0 @@
form.article-add.is-internal .article-content > .internal-border::after {
content: 'Du schreibst eine interne Notiz. Es wird keine ausgehende Mail an Gesprächsteilnehmer:innen versendet!';
padding-top: 6px;
display: block;
font-weight: bold;
font-size: 1.2em;
text-align: center;
}

View file

@ -1,9 +1,4 @@
--- ---
- name: reload monit
ansible.builtin.service:
name: monit
state: reloaded
- name: reload nginx - name: reload nginx
ansible.builtin.service: ansible.builtin.service:
name: nginx name: nginx

View file

@ -1,16 +0,0 @@
---
- name: "cron | Setze Umgebungsvariablen"
ansible.builtin.cron:
user: "{{ zammad_user }}"
name: RAILS_ENV
job: production
env: true
- name: "cron | Richte cron ein"
ansible.builtin.cron:
user: "{{ zammad_user }}"
name: "Loesche unbenutzte Zammad-Kunden"
minute: "1"
hour: "1"
day: "1"
job: " cd {{ zammad_home }} && chronic rbenv exec rails r {{ local_scripts_dir }}/zammad-delete-customers.rb"

View file

@ -1,8 +0,0 @@
---
- name: "customizations | Kopiere custom css"
ansible.builtin.copy:
src: senselab.css
dest: "{{ zammad_home }}/app/assets/stylesheets/custom/senselab.css"
owner: "{{ zammad_user }}"
group: "{{ zammad_user }}"
mode: "0644"

View file

@ -1,29 +0,0 @@
---
- name: "gateway: Domain zur Zertifikatsliste hinzufügen"
lineinfile:
path: /etc/dehydrated/domains.txt
insertafter: "^### systemausfall"
line: "{{ zammad_domain }}"
when: "'dehydrated' in ansible_facts.packages"
register: add_certificate
delegate_to: "{{ gateway_host }}"
- name: "gateway: Zertifikat erstellen"
command: dehydrated --cron -g
when: add_certificate.changed
delegate_to: "{{ gateway_host }}"
- name: "gateway: Proxy einrichten"
template:
src: nginx-rp-site.j2
dest: "/etc/nginx/sites-available/{{ zammad_domain }}"
force: no
delegate_to: "{{ gateway_host }}"
- name: "gateway: Seite aktivieren"
file:
src: "/etc/nginx/sites-available/{{ zammad_domain }}"
dest: "/etc/nginx/sites-enabled/{{ zammad_domain }}"
state: link
notify: reload reverse_proxy
delegate_to: "{{ gateway_host }}"

View file

@ -10,12 +10,6 @@
- import_tasks: zammad.yml - import_tasks: zammad.yml
tags: zammad tags: zammad
- import_tasks: customizations.yml
tags: customizations
- import_tasks: cron.yml
tags: cron
- import_tasks: ruby.yml - import_tasks: ruby.yml
tags: ruby tags: ruby

View file

@ -10,4 +10,4 @@
home: "{{ zammad_user_home }}" home: "{{ zammad_user_home }}"
shell: /bin/bash shell: /bin/bash
password_lock: true password_lock: true
system: yes system: true

View file

@ -10,6 +10,3 @@
dest: "/etc/nginx/sites-enabled/{{ zammad_domain }}" dest: "/etc/nginx/sites-enabled/{{ zammad_domain }}"
state: link state: link
notify: reload nginx notify: reload nginx

View file

@ -19,30 +19,12 @@
owner: "{{ zammad_user }}" owner: "{{ zammad_user }}"
group: "{{ zammad_user }}" group: "{{ zammad_user }}"
# https://github.com/zammad/zammad/issues/325
- name: "zammad | Wende plain-Text-Patch an"
ansible.posix.patch:
src: plain-text.patch
dest: "{{ zammad_home }}/app/models/channel/email_build.rb"
- name: "zammad | Ermittle Ruby-Version" - name: "zammad | Ermittle Ruby-Version"
ansible.builtin.command: cat "{{ zammad_home }}/.ruby-version" ansible.builtin.command: cat "{{ zammad_home }}/.ruby-version"
register: ruby_version register: ruby_version
changed_when: false changed_when: false
check_mode: false check_mode: false
- name: "zammad | Kopiere Skripte"
ansible.builtin.template:
src: zammad-delete-customers.rb.j2
dest: "{{ local_scripts_dir }}/zammad-delete-customers.rb"
mode: "0644"
- name: "zammad | Kopiere Updater"
ansible.builtin.template:
src: zammad-updater.j2
dest: "{{ local_scripts_dir }}/zammad-updater"
mode: "0755"
- name: "zammad | Erstelle Alias" - name: "zammad | Erstelle Alias"
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /root/.bashrc path: /root/.bashrc

View file

@ -1,44 +1,12 @@
# this is a database config sample for zammad ready to use with a postgresql db
# copy or symlink this file to config/database.yml to use it
default: &default default: &default
# For details on connection pooling, see Rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: 50 pool: 50
timeout: 5000 timeout: 5000
encoding: utf8 encoding: utf8
##### postgresql config #####
adapter: postgresql adapter: postgresql
username: {{ zammad_database_user }} username: {{ zammad_database_user }}
password: {{ zammad_database_password }} password: {{ zammad_database_password }}
# If the database server is not on localhost, you can set hostname and port:
host: {{ database_host }} host: {{ database_host }}
# port:
#### mysql config #####
# adapter: mysql2
# username: zammad
# password: <Password>
# If the database server is not on localhost, you can set hostname and port:
# host:
# port:
production: production:
<<: *default <<: *default
database: {{ zammad_database_name }} database: {{ zammad_database_name }}
development:
<<: *default
database: zammad_development
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: zammad_test

View file

@ -1,27 +0,0 @@
server {
listen 80;
server_name {{ zammad_domain }};
include snippets/letsencrypt.conf;
location / { return 301 https://$http_host$request_uri; }
}
server {
listen 443 ssl http2;
server_name {{ zammad_domain }};
ssl_certificate /var/lib/dehydrated/certs/{{ zammad_domain }}/fullchain.pem;
ssl_certificate_key /var/lib/dehydrated/certs/{{ zammad_domain }}/privkey.pem;
include /etc/nginx/snippets/add_headers.conf;
location /cable {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://{{ inventory_hostname }}:80;
}
location /ws {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://{{ inventory_hostname }}:80;
}
location / {
proxy_pass http://{{ inventory_hostname }}:80;
}
}

View file

@ -1,27 +0,0 @@
# https://github.com/JBails/PurgeZammad
# This script will delete all users that do not have an assigned ticket (open or closed), with no regards as to how long they haven't had a ticket
# i.e. doesn't care if the last ticket was deleted 30 seconds or 30 days ago
ticketless_customers = User.with_permissions('ticket.customer'){% if zammad_preserve_customer_domains is defined %}{% for domain in zammad_preserve_customer_domains %}.where('email NOT LIKE ?', '%{{ domain }}%'){% endfor %}{% endif %}.where('id NOT IN (SELECT customer_id FROM tickets)')
count = ticketless_customers.count
puts "#{count} customers without tickets found."
puts
ticketless_customers.find_each.with_index do |user, i|
next if user.permissions?(%w[admin ticket.agent])
next if user.id == 1
display_name = user.fullname + (user.fullname == user.email ? '' : " (#{user.email})")
User.transaction do
begin
user.destroy!
puts " #{display_name} deleted."
rescue => e
puts " #{display_name} could not be deleted: #{e.message}"
raise ActiveRecord::Rollback
next
end
end
end

View file

@ -1,46 +0,0 @@
#!/bin/bash
# {{ ansible_managed }}
set -eu
RUBY_VERSION=$(cat {{ zammad_home }}/.ruby-version)
RUBY_INSTALLED_VERSIONS=$(rbenv version | grep $RUBY_VERSION | cut -d ' ' -f2)
echo "Wechsle Verzeichnis..."
cd {{ zammad_home }}
echo "Leere Rails Cache..."
sudo -u {{ zammad_user }} RAILS_ENV=production rbenv exec rails r "Cache.clear"
echo "Aktualisiere Git-Repository..."
git pull
if [ -n "$RUBY_INSTALLED_VERSIONS" ]; then
echo "Aktualisiere Ruby-Version..."
sudo -u {{ zammad_user }} rbenv install "$RUBY_VERSION"
fi
echo "Aktualisiere bundler..."
sudo -u {{ zammad_user }} RAILS_ENV=production rbenv exec gem install bundler
echo "Aktualisiere Ruby-Pakete..."
sudo -u {{ zammad_user }} RAILS_ENV=production rbenv exec bundle install --without test development mysql
echo "Stoppe Zammad..."
systemctl stop {{ zammad_service }}
echo "Migriere Datenbank..."
sudo -u {{ zammad_user }} RAILS_ENV=production rbenv exec bundle exec rake db:migrate
echo "Assets vorkompilieren..."
sudo -u {{ zammad_user }} RAILS_ENV=production rbenv exec bundle exec rake assets:precompile
echo "Synchronisiere Translation-Dateien..."
sudo -u {{ zammad_user }} RAILS_ENV=production rbenv exec rails r "Locale.sync"
sudo -u {{ zammad_user }} RAILS_ENV=production rbenv exec rails r "Translation.sync"
echo "Starte Zammad..."
systemctl start {{ zammad_service }}
sleep 20
echo "Alles erledigt."