Comments (16)
Hi Oliver,
fair enough, I hear you loud and clear.
I still deem my argument valid, but yours is just as valid.
We need to take a look at this, and I will think about making the documentation clearer - if possible - in the meantime.
Regarding the lookup plugin you suggest: I already thought about that too. But the problem is resources: We need to prioritize the little time we have and focus on the most valuable features for now. So every contribution toward that will be appreciated, even if it is a work in progress PR.
from ansible-collection-checkmk.general.
The API supports the three modes "attributes", "update_attributes" and "remove_attributes". Robin and I were recently talking about using these in the collection, as well.
from ansible-collection-checkmk.general.
@ogaida , @robin-tribe29, @lgetwan
It might be that I have misunderstood Oliver Gaida's proposal and he exactly proposes the following
What's about state dependent default value for folder
?
- in case host is not registered and
folder
is not specified it defaults to/
as it is now - in case host is registered and
folder
is not specified it defaults to the folder name where it is already sitting.
from ansible-collection-checkmk.general.
@msekania
That's the behavior that I would expect, too.
from ansible-collection-checkmk.general.
regarding Dec 8, 2022 comment:
someone might be already using default value of folder
which is "/"
to move already existing hosts to "/"
(origin).
Anyway, what you meant (and Dec 9, 2022 my comment) , is definitely more useful approach!
and if one wants to move already registered hosts to "/"
, one should specify folder: "/"
explicitly.
from ansible-collection-checkmk.general.
@ogaida sorry, this one seems to have slipped by. Judging on the lack of affirmative feedback, this seems to be not a huge issue for many, so it was not a pressing matter. Anyway, we want to improve this.
To get this straight: The target state would be this:
- in case host is not registered and folder is not specified it defaults to / as it is now
- in case host is registered and folder is not specified it defaults to the folder name where it is already sitting.
@msekania and @ogaida can you please confirm this with a thumbs up?
Then we will put this on top of our priorities (which can still mean some wait time).
Otherwise, we would be very happy to see a PR from you. ✌️
from ansible-collection-checkmk.general.
I took a look into the openapi documentation. There are three different possibilities to change attributes:
- overwrite: use
attributes
- keep existing and only update given attributes: use
update_attributes
- remove only given attributes: use
remove_attributes
For me it seems the best solution to take this parameters as module parameters too. So anyone could decide what is the best option.
And about the folder, we should differentiate two cases:
- if host does not exist, then folder defaults to '/'
- if host already exist, leave folder untouched except if folder was explicit set to a new value.
from ansible-collection-checkmk.general.
Hi Oliver and thanks for your input!
I do want to say this: Ansible is a tool, which makes sure a certain state is there. So taking your example, I would in general actually expect this behavior, as Ansible cares less about what is already there, but rather about what you want to have there.
That philosophical detour aside, I understand your desire perfectly well and we will take a look at how to solve this.
Just do not hold your breath, because I see this as an enhancement rather than a bug, so it does not have the highest priority.
Feel free to propose a PR however, even if it is just a work in progress.
from ansible-collection-checkmk.general.
Hi Robin,
there are many ansible-modules out there, which care about what is already there. For example take the user module:
- name: Set maximum expiration date for password
user:
name: ram19
password_expire_max: 10
this will not reset the password or the shell or anything else. And yes, the desired state will be activated.
The great danger with the actual handling is, you remove tons of attributes if you dont know it. And here comes a first step... You should comment this problem in the main README.md and in the documentation of the host module. For example:
- name: update host, set the alias, delete all other explicit attributes and move back to folder /
tribe29.checkmk.host:
server_url: "http://localhost/"
site: "cmk"
automation_user: "automation"
automation_secret: "12345"
host_name: "myhost"
state: "present"
attributes:
alias: my alias
from ansible-collection-checkmk.general.
Another point is, there is no info module for hosts. Nothing to gather facts for existing hosts. So there is no easy way to update a host at all. How should i set the old attributes in a playbook, if i do not have a module for that. Should i do an API-Request to fetch the data first and then fumble them apart with ansible_json_query, really?
from ansible-collection-checkmk.general.
Excellent, please set update_attributes as the default update_method and please remember to not overwrite the folder if the host already exists. :-)
from ansible-collection-checkmk.general.
and please remember to not overwrite the folder if the host already exists. :-)
@ogaida, if one will not overwrite the folder, then, unfortunately, it will break already existing feature, namely moving existing host from current folder to another folder!
from ansible-collection-checkmk.general.
@msekania
your comment from Dec 9, 2022 is right. that's what I meant. But the comment from Dec 8, I do not know what you mean.
from ansible-collection-checkmk.general.
@robin-tribe29 Hi Robin, is there any hope that this bug will be fixed soon?
from ansible-collection-checkmk.general.
Hi Robin,
thank you very much for your quick answer. one point is very important to make the module idempotent. as we wrote about in November here in this issue, please set update_attributes as the default update_method.
Thanks in advance and best regards from Duderstadt ✌️
from ansible-collection-checkmk.general.
i made a pr last night. it passed the sanity checks. @robin-tribe29 & @lgetwan please give me some feedback to my changes.
I brought the attributes update-behavior from the API to the module. So if the host already exists, you can take the arg update_attributes
to just update what you want and leave all other attributes and folder untouched. It also supports remove_attributes
. On create the update_attributes
works like an alias for attributes and it is idempotent. remove_attributes
will be ignored on create.
from ansible-collection-checkmk.general.
Related Issues (20)
- [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] idempotency of rule fails on datasource_programs ruleset HOT 8
- [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
- [BUG] Error in the Agent role, Firewall seems to be only installed if checkmk_agent_server is an ip address HOT 3
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.