An approval process for VM provisioning

This recipe looks at how to build an approval process. If you don't happen to have vRealize Automation this could be an easy way forward.

Getting ready

Depending on how you want to build it, you may either need an e-mail server or a web server.

How to do it...

The approval process we are discussing is not a finished program but more of an architecture on how to construct one.

Using User interaction

This would be a program that uses User interaction for approval:

  1. Create a workflow that will provision a VM.
  2. Before the VM is actually provisioned, add a User interaction.
  3. Make sure the user interaction's timeout.date is somewhat in the future.
  4. Make sure that the security.group or the security.assignees have the users that are allowed to approve this VM assigned.
  5. Add a Boolean into the external inputs that approves or disapproves a VM.
  6. After the User interaction, add a base decision that works on the Boolean:

    Using User interaction

Using e-mail

This would be a program that uses email for approval:

  1. Develop a workflow that sends e-mail.
  2. Develop a workflow that checks an e-mail account for a given body text.
  3. Create a workflow that will provision a VM.
  4. Before the VM is actually provisioned, add a workflow that does the following:
    • Sends an e-mail to an approver
    • Checks the e-mail for a given sentence or word
    • Depending on the e-mail, either provisions or sends a "Sorry" e-mail to the user

      Using e-mail

Using a web page

This would be a program that uses a web page for approval:

  1. Develop a workflow that sends a custom event.
  2. Create a workflow that will provision a VM.
  3. Before the VM is actually provisioned, add a workflow that does the following:
    • Checks if the Custom Event has happened
    • Depending on that, deploys the VM

How it works...

There are lots of ways to create an approval process. The ones given here are the easiest. More complicated ones could involve a database where a user stores the information about the VM he wants. Another policy would check the DB each day and provisions the VMs where a certain flag is set. The flag can be altered through a workflow that uses either e-mail or a web interface.

You already have all the tools you need to create such a workflow or the ones given here. The recipes you need are as follows:

  • Sending and waiting for custom events in Chapter 6, Advanced Programming
  • Using PHP to access the REST API in Chapter 7, Interacting with Orchestrator
  • Working with policies in Chapter 8, Better Workflows and Optimized Working
  • Working with e-mails in Chapter 9, Essential Plugins
  • Working with SQL (JDBC) and Working with SQL (SQL plugin) inChapter 10, Built-in Plugins
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset