Extending node.rb to query external CMDB

Hello,

i have requirement to query my external CMDB, for different teams roles,
server life-cycle environment, group of servers belongs to some specific
group of application team, all those information and using those i want to
setup roles/permissions in katello/satello.

I am planning to populate all information as yaml using node.rb by adding
some more code to query external CMDB, and by using those values i can
design where my host belongs to and to which application group and what all
users have permission to that host.

Does anyone have any suggestion to make it better way? or extending node.rb
with all those information is the right way?

if anyone has any experience before with similar or matching requirements ?

Regards,
DJ

I would suggest using foreman_hooks for this, have a look at
https://github.com/theforeman/foreman_hooks

I've only ever use foreman_hooks for host create/destroy task but I think
it can be used for what you want.

Sean
<https://github.com/theforeman/foreman_hooks>

··· On Tuesday, 13 September 2016, Unix SA wrote:

Hello,

i have requirement to query my external CMDB, for different teams roles,
server life-cycle environment, group of servers belongs to some specific
group of application team, all those information and using those i want to
setup roles/permissions in katello/satello.

I am planning to populate all information as yaml using node.rb by adding
some more code to query external CMDB, and by using those values i can
design where my host belongs to and to which application group and what all
users have permission to that host.

Does anyone have any suggestion to make it better way? or extending
node.rb with all those information is the right way?

if anyone has any experience before with similar or matching requirements ?

Regards,
DJ


You received this message because you are subscribed to the Google Groups
“Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com
<javascript:_e(%7B%7D,‘cvml’,‘foreman-users%2Bunsubscribe@googlegroups.com’);>
.
To post to this group, send email to foreman-users@googlegroups.com
<javascript:_e(%7B%7D,‘cvml’,‘foreman-users@googlegroups.com’);>.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

I'd use a combination of foreman_hooks and an external process. Changing
node.rb will be obfuscation at best and you will risk losing your edits on
an upgrade.

foreman_hooks are great and (generally) work well. Be careful of any update
hooks you have which trigger and update - you'll find yourself in a
recursive nightmare (update triggers a hook which makes and update which
triggers the hook…). Great think about hooks is you can have various
actions base against what happens to the host. For example, we use a
destroy hook to clean AD entries and set CMDB entries when a host is
removed etc.

Personally, to scrape a CMDB and set permissions etc I'd probably look at
an external API based script and batch this. Just my view…