My CF Quickstart repo
This is a collection of automate code and dialogs to quickly get up
a useful CloudForms (ManageIQ) setup.
A selection of functional Service Dialogs, and all associated drop down helpers.
Configuration for common tasks. No coding.
OOTB, deploy by OS & Environment, Template, placed into config driven VLAN. Easily
expand out to finding templates by any tag alignment desired.
Automate code designed to be extended not overwritten. Specifically,
template & vlan finding code is hightly configurable and expandable.
Magic undocumented “any
“ tag to allow single value tags categories to be useful: e.g. tag
a template as environment
->_any_
Supports single SC items deploying to different providers (if not a great idea).
Flavors (for on-prem providers, and mapping to Cloud) are configured in a single location.
This has been “tested” against CloudForms 4.7 and 5.0.
5.0 is recommended.
This requires at least the automate part of
https://github.com/RedHatOfficial/miq-Utilities
Checkout RHPDS Testing Notes. There are some big enough labs in RHPDS
to test this out and kick the tires. Integration into a home lab, or a real world environment, will
require some care and feeding. I highly recommend playing with this in a home lab or RHPDS before an engagement.
From CF UI:
/StdLib/Settings/settingsstore
/StdLib/Settings/settings
settings
includes additional embedded methods - all of the settingstores in Automate, essentially/StdLib/Settings/settingsstore
to their respective git backed domains.
[root@cf rhc-miq-quickstart]# miqimport service_dialogs service_dialogs/
[root@cf rhc-miq-quickstart]# miqimport service_catalogs service_catalogs/
[root@cf rhc-miq-quickstart]# miqimport tags tags/VM_Tier.yaml
[root@cf rhc-miq-quickstart]# miqimport tags tags/Operating_System.yaml
Review “Admin Sanity Check” SC : the dynamic text output should help guiding
additional tagging and other configuration you need to do.
** HELP: If there is additional mindless configuration you find later that you need to do,
and can easily be detected, please update Service/DynamicDialogs.class/methods/sanity_dump.rb and submit
a PR.
At this point, you should be able to attempt to provision VMs with the provided dialog, to see what further
configuration is required.
The basic CF Service/VM provision process is unchanged, but rather than bundles, this uses what is described as
“create provision request” (from the $evm.execute method name) or “build vm provision request” or “ramrexx” method,
from the CF method name of the main monstrosity, and github username of Kevin Morey.
Morey’s original logic flow was to front load the decision making; A wide range dialogs can be quite robust,
and all feed into the same entry point (build_vm_provision_request), which was heavily customized to local
business logic, and VM (actually, tiers of identical VMs) provisioned through$evm.execute('create provision request')
. The actual VM state machine and methods can remain relatively
untouched. Yes, there is still VM placement logic, but the user, the dialog, and bVmPr decided the VM
was “production” (a business decision); the placement method only finds a technically suitable production
host/cluster/datastore/vlan.
This project expands on that flow, providing extensive mechanisms to both configure bVmPr, and to extend it, with
no changes to the core code. As there are central locations for generic settings, and flavors, as well as shared code
for template lookup, this provides exact alignment of functionality in the UI and at actual provisioning, and
reduces administrative and development overhead in maintaining consistency.
‘Flavors’ are configured in one place, in a simple Ruby hash. Manual mapping to cloud flavors is supported, but
of questionable value.
The provided example Service Dialogs and Catalog Items selecting some tags, with the template being searched for, or
based on selecting a template from a dropdown. The dropdown is wired into the same the “Template matching” code,
used in bVmPr.
With a dropdown in the SD, the UI will display as many templates for manual selection as tag selection and code provides.
With a dropdown selection made, or a template otherwise made in, e.g. a hidden field, bVmPr will use that directly
selected template.
If a selection of a dialog is not provided to bVmPr, it will run the match logic again, and if multiple templates are
found, select one randomly. This may be wholly inappropriate, or a reasonable strategy for balancing “close enough”
templates across providers, coincidentally, without any extra logic.
The “match chain” logic can easily be expanded, without any changes to the core framework.
A production install would not likely provide a user with a bunch of tag choice, and a drop down, but that instant
visual feedback to an administrator, tweaking configuration or tags, is invaluable.
The “match chain” is a configurable, ordered list, of methods to run. These are configure as module methods in
RhcMiqQuickstart::TemplateHelpers that match a particular method
definition. This (Ruby) module can be extended using Embedded Methods, without changing (or even copying) the core
project code.
The default configuration is a single match chain method, “aligntags”. This is influenced by the
setting template_match_method_align_tags_consider_as_tags
, which selects which tags to align between
what is requested and how the templates are tagged. It is worth noting that a template would need to
match on all categories, but only one value per category. Also of note, templates can be tagged with
a somewhat special tag value ‘_any‘. This is a workaround around some tag categories being single-value.
Matches templates on a location tag, to the templates provider’s location tag. Suitable for tagging
provider based on datacenter, for example, without having to manually tag every template.
VLAN placement is also implemented in an extendable fashion, conceptually similar to the template matching.
The configuration key network_lookup_strategy
can besimple
or manualbytag
.
simple
is dead simple, and sets the “network name” to the value of network_lookup_simple
.
“Network Name” is a relative concept. For RHV this is a vNIC Profile Name. I assume for other providers, the usual
CloudForms hilarious “rules” apply: I’d expect DVS networks to need dvs_ prepended, etc.
Using the new VMs tags, directly place VMs into suitable networks, via a configured naming convention for settings
keys. This does not require the actual network names to conform to any standard, only the custom setting key names.
Import the Service Dialogs and Service Catalog from the command line
Review “Admin Sanity Check” SC : the dynamic text output should help guiding
additional tagging and other configuration you need to do.
This project targets what real world experience has proven to be normal CloudForms
use cases. Copying & editing has been replaced with generalizing & configuring.
This project is built around service deployment of VMs, using Generic catalog
type, rather then the built in concept of service bundles.
The puts most of the logic up front, into the service catalog dialog (and dynamic
dialog helpers), and then build_vm_provision_request.rb.
A never ending goal, but general code flow here should be site-agnostic. Algorithms
themselves be relatively generic, taking configuration for trivial tweaks.
Further, as a log of logic is taking a long list of things (eg. templates,
VLANs, Datastores), and filtering that down to either one single item, or mostly
good enough itmes, we want to allow configuring the filter chain to change
operation of code via configuration, rather then editing code.
This does somewhat imply a meta framework, or a meta naming standard. Future work
would provide an easily configurable different “meta chain” for any decision point.
Configuration should be done in settings.rb, and not instance variables.
If custom code is required, minimal helper configuration should be included
dynamically, through configuration, for example the above noted “filter” style
flow is a chain of simple filters, selectable and ordered, by configuration,
not editing code.
Flavors, or t-shirt sizing, is configured in one place and used throughout
as a high level concept.
Flavors are configured in /Common/FlavorConfig/flavorconfig.
Currently, flavors do not support mapping “cloud flavors”.
A handful of sample dialog are provided. They fall into two extremes: extremely
trivial and very complex.
The trivial are more likely to be useful, the complex serve are a demonstration
of the interactions between the collection of dynamic elements. Ultimately,
as the complex dialogs filter down to a template dropdown, absent a lot of
tagging, they will often produce no results, and not even be able to be subimitted,
but may be a good admin/debugging tool.
The aforementioned miq-Utilities.
https://github.com/ramrexx/CloudForms_Essentials/
https://github.com/jeffmcutter/cf_shortcuts/tree/master/build_vm_provision_request