Closed zerwes closed 2 months ago
don't know how else but here goes. after those modifications it seems to work.
diff --git a/tasks/main.yml b/tasks/main.yml
index 132e3ca..304244f 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -60,7 +60,7 @@
path: "{{ opn_check_mk_lib_dir }}/plugins/{{ item }}"
state: directory
mode: 0755
- with_items: "{{ opn_check_mk_plugins | map('dirname') | unique |}}"
+ with_items: "{{ opn_check_mk_plugins | map('dirname') | unique }}"
when:
- opn_install_check_mk
- item | length > 0
@@ -71,7 +71,9 @@
dest: "{{ opn_check_mk_lib_dir }}/plugins/{{ item }}"
mode: 0700
with_items: "{{ opn_check_mk_plugins }}"
- when: opn_install_check_mk
+ when:
+ - opn_install_check_mk
+ - item | length == 0
- name: create check_mk local checks cache dirs
ansible.builtin.file:
@@ -89,7 +91,9 @@
dest: "{{ opn_check_mk_lib_dir }}/local/{{ item }}"
mode: 0700
with_items: "{{ opn_check_mk_local_checks }}"
- when: opn_install_check_mk
+ when:
+ - opn_install_check_mk
+ - item | length == 0
- name: copy check_mk additional files
ansible.builtin.copy:
hmm.. moved stuff around now it isn't working anymore.. will get back to you.
Sorry @crpb
the |
pipe at the end of the filter list was a half-baked thoughts; I wanted to ensure the result is a list.
fixed
Now the playbook should work with a simplified declaration like
opn_check_mk_local_checks:
- 600/crash_status.py
- 600/firmware_status.py
- 600/pkg_audit.py
- 600/pkg_check.sh
- 600/check_powerunit.sh
- gateways_status.py
- pfctl_status.sh
opn_check_mk_plugins:
- 60/wireguard
no need to add the directories first, they should be created
the filter opn_check_mk_plugins | map('dirname') | unique | list
should give you ['600', '']
The current problem was the lookup of the files in the root of ./files/ and not in a subdirectory. /ó\
nevermind that.... wrong terminal for results..
The current problem was the lookup of the files in the root of ./files/ and not in a subdirectory
I could implement something like a first_found
lookup for the src, so for example crash_status.py
could be placed in files/600/
(I would prefer this way), but also in files/
....
It was just a thought as you might have hosts that should run the check every half hour and others that are fine if that is run like only once a day. So you won't need to copy the file to multiple locations but only define it with the directory as a var/host.
It was just a thought as you might have hosts that should run the check every half hour and others that are fine if that is run like only once a day. So you won't need to copy the file to multiple locations but only define it with the directory as a var/host.
sounds like a reasonable scenario
have a look at 52b36189b7b4cdfe9c5611a6280e6a25bdc945a1 and let me know if it fits you needs
have a look at 52b3618 and let me know if it fits you needs
Yeah, that is looking good. it's filling again 🚀
Thank you @crpb :+1:
In general: looks like we have very similar scenarios ... opnsense in combination w/ checkmk, wireguard etc. Would you mind exchanging some thoughts and ideas?
Sure. if you have irc, i'm on OFTC as cb and Libera as crpb.
relates to issue #30