Ansible playbooks for Nuage Automation.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
roles
utils
.gitignore
README.md
install-dependencies.yaml
nuage_enterprise_create-domain-template.yaml
printout-and-fetch-entity.yaml
printout-validate-certs.yaml
printout.yaml

README.md

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.

Prerequisites

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.

install-dependencies.yaml

Dependent roles

If your playbook depends on external roles, you need to list them in

$PROJECT_ROOT/roles/requirements.yml

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:

$PROJECT_ROOT/roles/your_role

Example playbooks

EX01: Playbook for Debugging

Printout playbook that does nothing but prints out the nuage_auth and event variables. Both of them are set by xlab_si.nuage_miq_automate role. Output will appear in evm.log.

printout.yaml

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:

Set Logging Output

EX02: Another playbook for debugging

One more debug playbook that doesn't do anything useful yet. Similarly as the previous one it prints the nuage_auth and 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.

printout-and-fetch-entity.yaml

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:

printout-validate-certs.yaml

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.

nuage_enterprise_create-domain-template.yaml

Notice how we make use of xlab_si.nuage_miq_automate role to access Nuage credentials and event payload.

Expected Result

When we create a new Enterprise EXAMPLE, the playbook should create following structure:

Expected Result

License

BSD