Pfadanpassungen, Ermittle php-Version, munin-Task

This commit is contained in:
phil 2021-12-21 22:47:24 +01:00
parent 0bbd45ac53
commit 6c2cecfe91
6 changed files with 83 additions and 14 deletions

View file

@ -1,9 +1,11 @@
---
local_munin_path: /data/munin
mysql_socket: /var/run/mysqld/mysqld.sock
nextcloud_admin_user: systemausfall.org
nextcloud_admin_pw: admin
nextcloud_db_password: "{{ lookup('password', '/tmp/{{ instance.domain }}_db_pwd length=42 chars=ascii_letters,digits') }}"
nextcloud_munin_user_password: "{{ lookup('password', '/tmp/{{ instance.domain }}_munin_pwd length=42 chars=ascii_letters,digits') }}"
nextcloud_dl_url: https://download.nextcloud.com/server/releases
nextcloud_root: /data/nextcloud
nextcloud_install_path: "{{ nextcloud_root }}/{{ instance.domain }}"
@ -19,5 +21,4 @@ nextcloud_smtp_auth_type: LOGIN
nextcloud_smtp_host: sl-postbote.kahlo
nextcloud_smtp_port: 25
php_version: "7.4"
redis_config_file: /etc/redis/redis.conf
redis_config_file: /etc/redis/redis.conf

View file

@ -17,6 +17,10 @@
- name: restart phpfpm
service:
name: "php{{ php_version }}-fpm"
name: "php{{ php_version.stdout }}-fpm"
state: restarted
- name: restart munin-node
service:
name: munin-node
state: restarted

View file

@ -1,5 +1,5 @@
---
- name: "common: Apache-Module laden"
- name: "common | Apache-Module laden"
apache2_module:
state: present
name: "{{ item }}"
@ -9,25 +9,36 @@
- setenvif
notify: restart apache
- name: "common: Apache-Vorlage für Seitenkonfiguration kopieren"
- name: "common | Apache-Vorlage für Seitenkonfiguration kopieren"
copy:
src: roles/nextcloud/files/apache_site.conf
src: ../roles/nextcloud/files/apache_site.conf
dest: /etc/apache2/sites-available/nextcloud.conf
- name: "common: Apache-Seitenkonfiguration aktivieren"
- name: "common | Apache-Seitenkonfiguration aktivieren"
file:
src: /etc/apache2/sites-available/nextcloud.conf
dest: /etc/apache2/sites-enabled/nextcloud.conf
state: link
notify: reload apache
- name: "common: Kopiere PHP-CLI-Konfiguration"
- name: "common | Kopiere PHP-CLI-Konfiguration"
copy:
src: roles/nextcloud/files/30-sao.ini
dest: "/etc/php/{{ php_version }}/cli/conf.d/30-sao.ini"
src: ../roles/nextcloud/files/30-sao.ini
dest: "/etc/php/{{ php_version.stdout }}/cli/conf.d/30-sao.ini"
- name: "common: Kopiere Update-Skript"
- name: "common | Kopiere Update-Skript"
template:
src: roles/nextcloud/templates/nextcloud-updater.j2
src: ../roles/nextcloud/templates/nextcloud-updater.j2
dest: "{{ local_scripts_dir }}/nextcloud-updater"
mode: 0755
- name: "common | Erstelle munin-Verzeichnis"
file:
path: "{{ local_munin_path }}"
state: directory
- name: "common | Kopiere munin-Daten"
get_url:
url: https://raw.githubusercontent.com/munin-monitoring/contrib/master/plugins/nextcloud/nextcloud_
dest: "{{ local_munin_path }}/nextcloud_"
mode: 0755

View file

@ -1,12 +1,16 @@
---
- import_tasks: version.yml
tags: version
- import_tasks: gateway.yml
tags: gateway
- import_tasks: database.yml
tags: database
- import_tasks: php.yml
tags: php
- import_tasks: apache.yml
tags: apache
@ -17,5 +21,9 @@
- import_tasks: nextcloud_configuration.yml
tags: configuration
- import_tasks: fixes.yml
tags: fixes
# Das Plugin braucht noch Anpassungen
#- import_tasks: munin.yml
# tags: munin

45
tasks/munin.yml Normal file
View file

@ -0,0 +1,45 @@
---
- name: "munin | Verlinke Plugin"
file:
src: "{{ local_munin_path }}/nextcloud_"
dest: "/etc/munin/plugins/nextcloud_{{ instance.domain }}"
state: link
notify: restart munin-node
- name: "userinfo"
command:
cmd: 'php occ user:info munin'
chdir: "{{ nextcloud_root }}/{{ instance.domain }}"
become: true
become_user: "{{ instance.user }}"
ignore_errors: true
changed_when: false
register: occ_user
- name: "munin | Erstelle Nutzer"
command:
cmd: 'php occ user:add --display-name="munin" --password-from-env munin'
chdir: "{{ nextcloud_root }}/{{ instance.domain }}"
environment:
OC_PASS: "{{ nextcloud_munin_user_password }}"
become: true
become_user: "{{ instance.user }}"
register: occ_user_created
when: occ_user.stdout == "user not found"
- name: "munin | Kopiere Konfiguration"
blockinfile:
path: /etc/munin/plugin-conf.d/nextcloud
create: true
mode: 0600
marker_begin: "{{ instance.domain }}"
block: |
[{{ instance.domain }}]
env.username munin
env.password {{ nextcloud_munin_user_password }}
env.api_path /ocs/v2.php/apps/serverinfo/api/v1/info
env.scheme https
env.timeout 2s
env.updates_warning 1
when: occ_user_created.changed
notify: restart munin-node

View file

@ -11,8 +11,8 @@
- name: "php: {{ instance.domain }}: FPM-Pool einrichten"
template:
src: php_fpm_pool.j2
dest: "/etc/php/{{ php_version }}/fpm/pool.d/{{ instance.user }}.conf"
dest: "/etc/php/{{ php_version.stdout }}/fpm/pool.d/{{ instance.user }}.conf"
owner: root
group: root
mode: 0644
notify: restart phpfpm
notify: restart phpfpm