ansible-role-nextcloud/tasks/munin.yml

45 lines
No EOL
1.3 KiB
YAML

---
- 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