Best Practices from Oracle Development's A‑Team

End-to-end Compute Cloud Instance Management with Python and Ansible

This is a follow-up to my previous post "Automate Oracle Compute Cloud Service Management with Python Requests", which allows you to create and configure an Oracle Compute instance in one step. However, my previous post does not allow you to log into the newly created instance and perform further configuration inside the instance.

This post intends to demonstrate that using a combination of shell script and Ansible, we can move one step further in automating provisioning of Oracle Compute instances.

A simple use case implemented in this post is the following,

-- You are an Oracle Compute Cloud operator for your company.

-- Another employee of the company needs a WebLogic Service instance for the team.

-- You need to quickly create that instance and send relevant access information to that employee so that they can start using it.

One assumption made is this demo is that there is an pre-created storage volume exist in your Compute Cloud account. This volume contains JDK and WLS installation file. This volume will be mounted to the new instance so that Ansible can install JDK and WLS remotely. After installation, this volume can be un-mounted from the new instance.

The detailed steps for achieving such goal are documented in the attached scripts (starting with occ-python2711/occproject2711/create shell script). To create instance, simply run the create shell script.

But before you run the script, please make sure the following pre-requisites are met.

-- Obtain your Compute Cloud account authentication domain and URL (set it in CreateComputeCloudInstance.py)

-- Obtain your Compute Cloud account login (set it in create shell script)

-- Must be in "Compute_Operations" role

-- There is adequate Oracle Compute resource available (at least 1 OCPU, 40GB of storage and 1 external IP)

-- Ansible installation in your local Linux environment (where the scripts will be run)

-- Python 2.+, which should be pre-installed in most Linux systems


Please go over shell script "create" to learn more details of the implementation. CreateComputeCloudInstance.py documents the steps for creating Compute instance using Compute Cloud REST API. occ-create.yml  contains documentation for configurations performed inside the instance.


Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha