Afternoon all
I'm currently scoping out options for writing a simplified 'microservices'
dashboard to sit on the front of Foreman and manage our various internal
microservices.
Currently, Foreman is our ENC, and we use host-groups with parameterised
classes.
Therefore it's quite common to over-ride a specific puppet class value per
host-group, such as the 'version' of the service required.
After some spelunking through the v2 API with apipie-bindings, I've found a
way through… However I was just wondering if there's an easier way that
I've missed.
Currently, I've got:
-
Identify a specific host-group:
api.resource(:hostgroups).call(:index, :search => 'jwtsvc') -
Get a list of Puppet classes assigned to this host-group, using :id
from above:
api.resource(:hostgroups).call(:show, :id => 17) -
Get a list of Smart-Class parameters for this host-group and
puppet-class, using host-group ID and Puppet-class ID from 2:
api.resource(:smart_class_parameters).call(:index, :hostgroup_id => 17, :puppetclass_id
=> 554) -
Identify any over-ride values for specific Smart-Class param
identified from 3:
api.resource(:override_values).call(:index, :smart_class_parameter_id =>
- To update the value, with the smart-class param ID from 3 and :id
from 4:
api.resource(:override_values).call(:update, :smart_class_parameter_id
=> '3460', :id => 40, :override_value => { :value => '1.1.1-1' } )
This feels quite convoluted, and will undoubtedly result in lots of API
calls, as our average Puppet class has 5-6 smart-class params that we are
over-riding per host-group…
So, is there a more efficient way that I've missed?
Thanks in advance.
Gavin