DevOps, POWER and IBM Cloud – the Perfect Combination

Cloud computing has fundamentally changed how infrastructure is consumed—with a few simple clicks, you can get endless access to any resource—such as virtual machines (VMs), storage volumes, Kubernetes clusters, and more. To that end, we recently announced IBM Power Systems in the IBM Cloud. Now getting immediate access to AIX and IBM i in the IBM Cloud is easier than ever.

While immediate point-and-click style access (i.e., using a GUI) is convenient, in the world of DevOps automation, more is expected—people are looking to “codify” infrastructure. That’s where technologies like HashiCorp Terraform come in. Terraform’s motto is all about “Infrastructure as Code” (IaC) and provisioning any cloud resource in a simple and automated fashion. And the good news is that this ability is fully enabled for Power Systems in the IBM Cloud (in addition to the rest of the IBM Cloud resources). To that end, consider the following high-level use cases:

Automatically provision a virtual machine and install some software

What happens when someone on your team needs a new application environment? It’s still commonplace that the compute, storage and network resources are independently provisioned. When that’s done, a software expert is engaged to perform the software installation—and hours, days or sometimes even weeks later, the end user can finally start using the application.

With Terraform, all of this can be automated—the entire cloud infrastructure (i.e., the VM, its storage and its networking resources) can be automatically provisioned… and the software installation can be automatically done atop all that for a complete end-to-end solution.

Quickly provision an entire QA infrastructure

Taking the previous example one step further, imagine the QA team needs an entire infrastructure and application created for test purposes. This setup process can take weeks for infrastructure and software teams. What happens if the QA team encounters a problem and things need to be rebuilt? Potentially weeks of delays.

Terraform can define the landscape as code–so that IT administrators can simply run [terraform apply] and go work on something else while Terraform does the heavy lifting and provisions the entire estate. When it’s done (total time is a function of the number of IT resources Terraform needs to provision), IT administrators can turn the environment over to the QA team.

As you can probably tell, this technology can introduce tremendous benefit to any organization, as it can automate everything from the simplest VM deployment to the most complex hybrid cloud environment.

Let’s Dig In!

Let’s walk through a simple scenario that will create an AIX VM in the IBM Cloud and provision some software atop the freshly deployed VM:

  1. Download and install Terraform and the IBM Cloud Terraform provider
    As of this writing, the IBM Cloud Terraform provider requires Terraform 11.x to be used. Visit the HashiCorp download site to download and extract the Terraform binary for the appropriate platform. You can run Terraform from any Linux or Windows operating system. Note that HashiCorp does not currently provide ppc64le binaries, so if you want to run Terraform on Linux on POWER, build the binary from source. You should also download the latest official version of the IBM Cloud Terraform provider from the IBM download site. After extracting the binary, place it in your ~/.terraform.d/plugins directory.

  2. Create your IBM Cloud account and configure a Power Virtual Server instance
    To run the example against IBM Cloud, you need to create a billed IBM Cloud account and provision a “Power Systems Virtual Server” instance under the “Compute Infrastructure” section. As part of this process, it’s recommended to provision a VM manually through the IBM Cloud interface to become familiar with the networking, SSH keys, etc. Once you can provision VMs manually, then you are ready to move on to the automated steps.

  3. Install the IBM Cloud and Power Virtual Server CLIs
    To run the Terraform example, we will need to create a public-vlan network that our VMs can attach to so that we can access the VMs over the Internet. Note that this step is only necessary if you don’t have network connectivity between the system on which Terraform is installed and the Power Virtual Server VM. To create the public-vlan network, you first need to install the IBM Cloud CLI by following these steps. Next you need to install the Power Virtual Server CLI utility by running [ibmcloud plugin install power-iaas].

  4. Create a public-vlan network
    Create a public-facing network named “public-net” by running [ibmcloud pi network-create-public public-net --dns-servers "8.8.8.8"]. Note that you will use the “public-net” value in the fifth step when you’re populating the network section of the variables.tf file.

  5. Download and run the Terraform example
    To make things easy, we’ve provided a sample Terraform script on GitHub. Use Git to clone this repository on the same system on which you configured Terraform in the first step. Update the variables.tf file with values that coincide with your IBM Cloud configuration. For starters, you will need to create an IBM Cloud API key and feed that into the variables.tf file—the API key should be kept secret as it allows IBM Cloud resources to be created and assigned to your user account (i.e., you will be paying for them). You will also need to create an SSH key and upload it to the IBM Power Virtual Server interface. The variables.tf file will also require you to input the base64-encoded form of the private key (you can generate this by running [base64 -i path-to-private-key-file] so that the Terraform SSH provisioner can connect to the AIX VM and perform the software installation. After you have the variables.tf file filled out, you can run the example by following the instructions in the README.md file. And that’s it—you just automated the deployment of an AIX VM and performed automated software installation in the IBM Cloud! You can customize this example to suit your specific needs. When Terraform is done, you will see output that looks like:

    ibm_pi_instance.pvminstance: Still creating… (4m30s elapsed)
    ibm_pi_instance.pvminstance: Still creating… (4m40s elapsed)
    ibm_pi_instance.pvminstance: Creation complete after 4m45s (ID: 468318ac-2dec-45ac-b797-79780c5a6c61)

    Apply complete! Resources: 2 added, 0 changed, 0 destroyed.

    Outputs:

    health_status = WARNING
    ip_address = [
    {
    externalip = a.b.c.d,
    ip = a.b.c.d,
    macaddress = fa:a2:3b:aa:75:20,
    networkid = 4808df8f-36da-474d-aae7-f2e2cd887833,
    networkname = public-net,
    type = fixed
    }
    ] min_proc = 0.5
    progress = 0
    status = ACTIVE

  6. Clean up your cloud resources
    Don’t forget to run [terraform destroy] when you’re done to clean-up the cloud resources so that you don’t incur unwanted charges.

More Examples

Want to check out more examples? No problem, we’ve got you covered. You can look at several more examples in our GitHub repository—every directory name that starts with “ibm-pi” contains IBM Power Virtual Server on IBM Cloud Terraform examples.

Wrapping Up

While the example we showcased was fairly straightforward, this can be used as a framework to automatically provision much more complex environments. Terraform is a technology that will continue fueling innovations, so check it out today to see how it can help you!

Join The Discussion

Your email address will not be published. Required fields are marked *