Comments (8)
This is related to #186.
You can try to add more conditions to ensure idempotency. We are aware, that the current state is not great, but it is out of our hands. We can only provide viable workarounds.
Try this:
- name: add ssh rule
checkmk.general.rule:
ruleset: datasource_programs
rule:
location:
folder: "/"
conditions:
host_labels: []
service_labels: []
host_tags:
- key: ssh
operator: is
value: ssh_secure
properties:
description: ssh datasource for ssh_secure host tags
value_raw: "'ssh -T root@$HOSTNAME$'"
state: present
from ansible-collection-checkmk.general.
ok, i'll try, but i'll be going on holiday for a week, so it'll have to wait a bit :-)
from ansible-collection-checkmk.general.
I added host_labels and service_labels , but sadly, that didn't fix the issue; similar issues with special_agents:vsphere and snmp_communities
should i use more conditions to try and fix this, or does it not work because the labels are empty?
maybe i should just delete the rules.mk file and start over every time? but i'd rather not do that...
from ansible-collection-checkmk.general.
it seems adding disabled: false may solve the issues... i don't get why this and the labels cannot have default values? but it also does not complain if these are not added...
I would like this to change that the labels en disabled actually have default values that still work for the workaround idempotency please
from ansible-collection-checkmk.general.
So, i have it(idempotency workaround) working for the "datasource_programs" rule, but not for snmp_communities and special_agents:vsphere , but the only difference really is the rule and that i'm using host_name instead of host_tags? :
- name: add ssh rule
checkmk.general.rule:
ruleset: datasource_programs
rule:
location:
folder: "/"
conditions:
host_labels: []
service_labels: []
host_tags:
- key: ssh
operator: is
value: ssh_secure
properties:
comment: "Ansible managed"
description: ssh datasource for ssh_secure host tags
disabled: false
value_raw: "'ssh -T root@$HOSTNAME$'"
state: present
- name: Add SNMP rule
checkmk.general.rule:
ruleset: snmp_communities
rule:
location:
folder: "/"
conditions:
host_labels: []
service_labels: []
host_tags: []
host_name:
operator: one_of
match_on:
- "{{ host.name }}"
properties:
comment: "Ansible managed"
description: password for snmp {{ host.name }}
disabled: false
value_raw: "('{{ host.snmp }}')"
state: present
when: host.snmp is defined
- name: Add ESX rule
checkmk.general.rule:
ruleset: special_agents:vsphere
rule:
location:
folder: "/"
conditions:
host_labels: []
service_labels: []
host_tags: []
host_name:
operator: one_of
match_on:
- "{{ host.name }}"
properties:
comment: "Ansible managed"
description: password for ESX {{ host.name }}
disabled: false
value_raw: "{ 'direct': True, 'infos': ['hostsystem', 'virtualmachine', 'datastore', 'counters'], 'secret': '{{ host.esx }}', 'skip_placeholder_vms': True, 'spaces': 'underscore', 'use_pysphere': False, 'user': 'root', 'ssl': False, 'snapshots_on_host': False}"
state: present
when: host.esx is defined
from ansible-collection-checkmk.general.
@alien999999999 as has already been explained in other issues, this is a general problem and neither specific to distinct rule sets, nor something we can quickly fix. Hence, I will close this issue and ask you to review the initially linked issue and maybe refer to the forum to exchange ideas and workarounds.
Thank you for your understanding.
from ansible-collection-checkmk.general.
I reread the initially linked issue and contrary to it's title (and original issue) it did end up being about this. It seems to me the workarounds for idempotency on rules (because checkmk code is not great about this atm) work for some rulesets, but some rulesets have different requirements for idempotency; or just plainly not work... I think the only real way to ensure idempotency on rules is to redesign this part of checkmk; start by adding a unique id; it may at least enable some easier idempotency workarounds
from ansible-collection-checkmk.general.
We are actually currently reworking the rule
module in this collection to better account for the already existing rule IDs in Checkmk. That still does not solve all the issues, but rest assured, we are doing our best to improve with every release. Sometimes they are baby steps, but we are certainly moving forward! 👟
from ansible-collection-checkmk.general.
Related Issues (20)
- [BUG] activation module with redirect set to true fails if API returns a 302 (possibly only HTTPS) HOT 6
- [BUG] update_attributes on folder with network scan enabled (and a network scan result present) fails HOT 5
- [FEED]Agent download fails in distributed setup HOT 1
- [BUG] Inconsistent behaviour of Ansible modules (update vs remove + compared to API) HOT 10
- [BUG]: reset_password in user module recreates the user HOT 1
- host_tag_group Endpoint changed the parameters id/ident HOT 1
- [BUG] notification rules is not recognized by checkmk.general.rule HOT 3
- [FEED] HOT 2
- [BUG] Register Linux agent for TLS fails with CRE edition HOT 3
- [BUG] Agent role has unecessary changes, when the agent is already registered and added to CheckMK HOT 2
- [Feature Request] Create Host and Service Groups Rules via Ansible HOT 4
- [BUG] folder creation always lowers the foldername HOT 10
- [Feed] folder lookup plugin does not return the title of the folder HOT 3
- fixed downtime? HOT 4
- [BUG] "Register Agent for TLS" does not allow for "!" in checkmk_agent_auth on Linux HOT 1
- [FEED] Only register agent if host was created on the server or agent was installed HOT 4
- [FEED] Implement module for LDAP Connections
- [BUG] module "folder" not idempotent HOT 10
- [BUG] `discovery` module out of sync with the Checkmk REST API HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible-collection-checkmk.general.