CD3 Automation Toolkit Integration with OCI Full Stack DR

Infrastructure as Code (IaC) is essential in the cloud because it automates infrastructure provisioning, ensures consistency, and improves scalability. It helps reduce costs, enhances security, and improves administrator productivity. IaC also integrates well with DevOps practices, enabling agile development and efficient multi-cloud or hybrid cloud management. By treating infrastructure as code, teams can version control, collaborate, and standardise deployments, resulting in faster, more reliable cloud operations.

In Oracle Cloud Infrastructure (OCI), the CD3 Automation Toolkit is available to assist our customers in beginning their IaC journey using Excel templates. CD3 stands for Cloud Deployment Design Deliverable. The CD3 Automation Toolkit enables users to efficiently build, export, and manage OCI resources by transforming Excel templates into fully functional Terraform modules in just minutes. The CD3 Toolkit also provides scripts that use OCI SDK modules, available as Python scripts. The CD3 Toolkit ensures seamless resource management through the OCI DevOps GIT service and Jenkins Pipelines.

For more information, please visit CD3 Documentation.

Getting Started with CD3

There are two ways to install and use CD3

  1. OCI Resource manager stack

  2. Manual Container launch

Depending on your preference, you can install CD3; in this example, I have used the Manual Container launch approach (Option 2). For more details, refer to CD3 docs

I have built the current CD3 v2024.4.1 image and started the container cd3-toolkit-1. The below screenshot shows that I could run the exec into the running container.

Connect the container to OCI Tenancy and use CLI.

  1. After completing the required prerequisites, I have initialised the environment. You must update all the required details in the tenancyconfig.properties file. Please take a look at the tenancy configuration for more details.
cd /cd3user/oci_tools/cd3_automation_toolkit/user-scripts/
python createTenancyConfig.py tenancyconfig.properties

  1. I have used “fsdrdemo” as a prefix, which you can see in the generated folder structure and file names.

  2. I will use the toolkit with CLI, but integration with Jenkins is also available. To use Jenkins, you must provide the required parameters in the tenacyconfig.properties file.

  3. The next step is to update the fsdrdemo_setUpOCI.properties file and run the setUpOCI.py script. For more details, please refer to the CLI configuration.

cd /cd3user/oci_tools/cd3_automation_toolkit/
python setUpOCI.py /cd3user/tenancies/fsdrdemo/fsdrdemo_setUpOCI.properties

You can manage the various supported services for your OCI Infrastructure using the CD3 toolkit.

Full Stack DR integration with CD3 toolkit

For Full Stack DR integration with the CD3 toolkit, the automation is available as Python scripts that use OCI Full Stack DR SDKs. CD3 enables users to export and update Full Stack DR plans. Different DR plans can be exported into separate Excel tabs. DR plan steps can be updated in Excel and then applied to the Full Stack DR using the toolkit.

Common Use Cases:

These scripts will be helpful for the below-mentioned Full Stack DR use cases.

  • If an existing DR Protection group member is updated in the Full Stack DR, the DR plan gets deleted. To handle this, export all User-defined steps to CD3 Excel and use this data to recreate the new DR plan after updating a member.

  • Clone the User-Defined Steps from one plan to another within the same region or across regions.

  • Manage the User-Defined Steps in DR plans with an Excel spreadsheet.

Features:

  • Easy to manage and update User-Defined Steps.

  • The order of the DR Plan's steps is preserved in the Excel sheet, allowing steps to be created in the same sequence as desired in the console.

  • A single Excel sheet can manage all DR Switchover and Failover plans.

Update Full Stack DRPG members:

Let’s assume we need to modify the members of the DR protection groups. If you add or modify the members in the DRPG, the existing DR plans will be deleted. Assuming this DR plan has multiple user-defined plan groups/steps, manually creating those steps using the OCI console will be time-consuming. Let’s use the CD3 toolkit FSDR scripts to achieve this task. We are going to perform the following tasks:

  1. Export the existing DR plan - Using CD3 scripts

  2. Modify the members in DRPG - Using OCI Console

  3. Create the new DR plan - Using OCI Console

  4. Export the new DR plan - Using CD3 scripts

  5. Update the new DR plan - Using CD3 scripts

Export the existing DR plan - Using CD3 scripts:

  1. We already have an existing DRPG pair, with a moving instance and volume group added to the Primary DRPG. In addition to the built-in plan groups, I have created and customised the switchover plan with various user-defined plan groups and steps.

  1. Run the setUpOCI.py script and select the OCI FSDR option
python setUpOCI.py /cd3user/tenancies/fsdrdemo/fsdrdemo_setUpOCI.properties

Enter Other OCI Tools - Option 17

Enter OCI FSDR - Option 3

  1. We have two options ( Export DR plan and Update DR plan); since we are going to take an Export of the current DR plan, select Export DR plan - 1

    Enter Update DR plan - Option 2

  2. It will prompt you to provide the Excel file name, Excel sheet name and DR plan OCID.

    Excel File name: fsdrdemo_oci_fsdr-plan.xlsx

    Sheet Name: FSDR-Plan

  3. The file will be generated in the “/cd3user/tenancies/fsdrdemo/othertools_files” folder.

     [cd3user@f52b32925428 othertools_files]$ pwd
     /cd3user/tenancies/fsdrdemo/othertools_files
     [cd3user@f52b32925428 othertools_files]$ ls -ltr
     total 24
     -rw-r--r-- 1 cd3user cd3user 23235 Oct  7 11:33 fsdrdemo_oci-fsdr-plan.xlsx
     [cd3user@f52b32925428 othertools_files]$
    
  4. Since the excel file is inside the container, you need to copy to the local folder to access the file. This can be done by using the below docker command. Make sure to replace the docker container id and folder structure. In my example. f52b32925428 is my docker container id and /Users/surajramesh/cd3/cd3-data local folder where i want to copy the file.

 docker cp f52b32925428:/cd3user/tenancies/fsdrdemo/othertools_files/fsdrdemo_oci-fsdr-plan.xlsx /Users/surajramesh/cd3/cd3-data
  1. You can verify the DR plan details from the excel sheet. Refer to the Readme sheet for the instructions of how to use the excel template. FSDR-Plan sheet will have both the built-in and user-defined plan groups/steps with all the attributes.

Modify the members in DRPG and Create the new DR plan using OCI Console:

  1. Add new compute member in the Standby DRPG.

  2. Existing DR plan gets deleted.

  3. Create the new Switchover plan.

  4. Gather the OCID of the new DR plan.

  5. Follow the same process as mentioned in the above mentioned export DR plan steps, but make sure you provide the new sheet name and the new DR plan OCID which we generated now in the DR plan OCID details and copy the sheet to the local folder.

  6. I have provided FSDR-New-Plan in the sheet name and new DR plan OCID generated.

  7. Copy the excel sheet to the local folder.

 docker cp f52b32925428:/cd3user/tenancies/fsdrdemo/othertools_files/fsdrdemo_oci-fsdr-plan.xlsx /Users/surajramesh/cd3/cd3-data
  1. Now you will have FSDR-New-Plan sheet with the new DR plan details with only built-in plan groups.

Update the new DR plan - Using CD3 scripts

  1. Let’s copy the required User-defind plan groups and steps from the FSDR-Plan ( old DR plan) to the FSDR-New-Plan (new DR plan) sheet.

  2. You can refer to the Readme sheet in the generated excel sheet of updated the various required fields during the update DR plan command.

  1. Copy the required user-defined group and steps from the FSDR-Plan sheet to the FSDR-New-Plan sheet. Make sure you leave the id,steps.id value as empty and follow other instuctions as mentioned in Readme. You can copy and paste in the specific order as per the original DR plan. Don’t modify the built-in plan groups and steps. Make sure the readme file instructions are correctly followed. Once its done, save the file.

  2. Copy the Update excel file from the local system to the docker container using the below command.

 docker cp /Users/surajramesh/cd3/cd3-data/fsdrdemo_oci-fsdr-plan.xlsx f52b32925428:/cd3user/tenancies/fsdrdemo/othertools_files/fsdrdemo_oci-fsdr-plan.xlsx
  1. Run the setUpOCI.py script and select the OCI FSDR option
python setUpOCI.py /cd3user/tenancies/fsdrdemo/fsdrdemo_setUpOCI.properties

Enter Other OCI Tools - Option 17

Enter OCI FSDR - Option 3

Enter Update DR plan - Option 2

  1. Verify the updated DR plan in the OCI console. It should have all the required user-defined groups and steps in the required order.

Standalone FSDR Scripts:

As mentioned earlier, CD3 toolkit offers broad capabilities of managing OCI Infrastructure using excel based templates. In case if you would like just use the FSDR scripts alone, you can also use as a standalone scripts.

Excel template, export, and update scripts are available here. You need to make sure you have installed the required Python packages and have required OCI authentication to use those scripts.

Conclusion:

The CD3 Automation Toolkit offers a powerful and efficient way to manage OCI resources through Infrastructure as Code and scripts. By leveraging Excel templates, users can easily export, update, and manage Full Stack Disaster Recovery plans, ensuring seamless integration and management of user-defined steps. The toolkit's ability to automate and streamline these processes not only saves time but also reduces the risk of errors associated with manual configurations. Additionally, the option to use FSDR scripts as standalone tools provides flexibility for users who wish to focus solely on disaster recovery management. Overall, the CD3 Automation Toolkit enhances the agility and reliability of cloud operations, making it an invaluable resource for organizations utilizing OCI.

Additional Resources: