Closed emmetog closed 3 years ago
To give the most flexibility, ideally it would also be possible for a host to have multiple classes, for example if I have a separate webserver and database in production but in test I want the same server to act as both. Does the current implementation of fetchapply allow hosts to have multiple classes?
Thank you for this suggestion. You raise a valid point, and I agree that a "manual override" of the direct hostname-to-class association would be a useful feature, especially for larger organizations. I will look into adding this feature sometime this week. Thanks again!
Alright, manual class assignments have been added. As this is brand new (and required rewriting most of the script), I would greatly appreciate it if you could test it out and let me know if there are any bugs, issues, etc. that slipped through my testing. Thanks!
P.S. I'll be updating the documentation shortly (within an hour), explaining how to handle manual class assignments, in case you happen to see this message right away.
Here's the documentation on adding manual class assignments:
https://github.com/P5vc/FetchApply#classes
Long story short, simply add an assignments
file within classes that you wish to manually assign hosts to, and then list those hosts' hostnames one per line in the file.
Also, make sure to use the installation script to uninstall Fetch Apply, and then reinstall it on any system you test this on, as it will require a new configuration file and updated codebase.
Looks great, will give it a spin! Thanks @P5vc!
Looks great, will give it a spin! Thanks @P5vc!
No problem! Let me know how it goes!
Also, feel free to use the new class detection command (sudo fa list-classes-to-run
), which will run just the detection phase, so you can verify exactly which classes it plans to run and make sure that it's correctly detecting any automatic and/or manual assignments.
From the README:
Is it possible to explicitly manage the mapping between hosts and classes instead?
My use case is that my hostnames don't always follow a pattern and in some cases the hostnames are not even controlled by me, they are imposed upon me. For this reason I'm not going to be able to rely on using a naming convention to map between hostnames and classes. My only option is to do it explicitly.
For reference, ansible does this in an "inventory" file which ends up looking something like this (they use
yml
):Could fetchapply allow a similar explicit mapping? If so, I'd likely also need a configuration option in
/etc/fetchapply
to disable pattern mapping of hosts to classes, just to avoid unexpected surprises.