Nuage Ansible Playbooks
This repository contains example Ansible playbooks that demonstrate how to approach to Nuage EMS-event-driven Automation. Purpose is to help you get started writing your own playbooks in a form that they can be triggered by CloudForms Automation Instances.
Dependent pip packages
If your playbook depends on any pip package, you'll need to install it to appliance upfront or else playbook execution will error. Run the playbook listed below against your appliance(s) to do so.
If your playbook depends on external roles, you need to list them in
NOTE: The roles/ directory MUST to be on top level of your repository, it cannot be nested in order for Embedded Ansible to automatically install requirements for you.
Embedded Ansible is smart enough to have them downloaded for you, please read official documentation on exact format of this file. It's best if you use roles published to Ansible Galaxy portal, but it's not required.
As a last resort, you can manually bundle your roles in the roles/ directory:
EX01: Playbook for Debugging
Printout playbook that does nothing but prints out the
Both of them are set by xlab_si.nuage_miq_automate role. Output will appear in
This playbook requires no additional pip packages.
NOTE: Make sure you set Logging Output to Always or else playbook's output will be suppressed by MIQ. Verbosity can be left to 0 (Normal)_, though:
EX02: Another playbook for debugging
One more debug playbook that doesn't do anything useful yet. Similarly as the previous one
it prints the
event variables. In addition, it performs API request to
the Nuage server (using
nuage_auth credentials) to fetch entity by ID. Both entity
type and ID are retrieved from payload of EMS event that triggered the execution.
This playbook requires vspk pip package installed on appliance, read the Prerequisites section to learn how to do it.
EX03: One more for debugging - with SSL cert validation
Other debug playbooks have SSL certificate validation explicitly turned off my means of
vars: manageiq_validate_certs: False
But this is not the case with regular playbooks, therefore we provide yet another debug playbook:
Cert validation is turned on by default for all playbooks which means playbook will fail with appliances that use self-signed certificates. This playbook can be used to validate whether certificate validation would succeed.
You can turn SSL certificate validation off also in Automate explorer by defining Input Parameter for the playbook with a False default value (for arbitrary playbook):
EX04: Create DomainTemplate upon Enterprise CREATE
Finally a more real-world scenario playbook.
Following playbook creates a Nuage DomainTemplate with some ZoneTemplates and
SubnetTemplates and instantiate it. Playbook is supposed to be triggered upon
nuage_enterprise_create event in CloudForms.
Notice how we make use of xlab_si.nuage_miq_automate role to access Nuage credentials and event payload.
When we create a new Enterprise EXAMPLE, the playbook should create following structure: