ManageIQ Blog


Tagged with Automate

Embedded Ansible — Part 3, Ansible in an Automation Workflow

Part one of this series described the functionality for using built-in roles to perform tasks with Ansible playbooks rather than Ruby methods in Fine. Part two of this series looked at how host lists and input parameters can be passed to embedded Ansible playbook services and methods. This article will discuss how a playbook method can form part of a larger automation workflow by interacting with the ManageIQ Automate workspace.

Embedded Methods

One of the exciting new features in CloudForms 4.6 within Automate is Embedded Methods. That is, one can store reusable, directly callable, ruby code within Automate and access from other Automate Methods.

Best Practice Recommendations for Automate

Few days ago one of our fellows, Christian Jung, published a very good article explaining best practices while coding Ruby code inside Red Hat CloudForms. The post does not claim to be exhaustive, but establishes guidelines about coding, naming conventions and rules to follow in order to make the code cleaner, easier to understand, and more consumable by others.

In the article, several key topics are discussed, such as:

Using Tags for Access Control

Most systems use Access Control Lists (ACL’s) to manage user’s access to objects. Common examples are ACL’s for file systems, LDAP, Web Servers and many more. Anyone who has had to create ACL rules and maintain them knows how complicated this can be. To make access control easy again, CloudForms uses tags. If the group a user belongs to has the same tag as the accessed object, access is granted, if not, access is denied.

inspectXML – Dump objects as XML

This is pretty simple but very useful. I have done a little research and whilst inspect is a way of seeing inside of an object its also hard to read and not very re-usable. Being somewhat old now (crazy thought) XML used to be the way we described things. Yes I know yaml, json etc have come to replace XML in languages such as Ruby, but I cannot get away from XML is far easier to read and self describing than the aforementioned.