Create Oracle RDS Using Ansible

Create an Oracle RDS database in AWS within minutes by automating the entire provisioning process using Ansible.

For this demo I’m running Ansible (2.9.2) and the latest version of AWS CLI on RHEL8.

Step 1. Pre-reqs

Note: boto is required for the Ansible modules. Ansible uses python libraries in the backend, so you need to install the boto on your system. Use the below command to download the boto module.

pip3 install boto

Step 2. Create Ansible Playbook

Create an empty file/playbook called “create-rds-oracle.yml”, then copy the content below into the playbook. Modify the playbook to fit your specs.

- name: create-oracle-rds
  hosts: localhost
  connection: local
  gather_facts : false

  tasks:
    - name: provision oracle rds intance
      rds:
        command: create
        region: us-east-1
        instance_name: orards
        db_engine: oracle-se2
        size: "10"
        instance_type: db.m5.large
        license_model: bring-your-own-license
        username: master
        password: "welcome1"
        tags:
          environment: test

Find this playbook and other cloud dba stuff on my Github.

Step 3. Run Ansible Playbook

Create the Oracle RDS instance by running the playbook. Use the command below.

ansible-playbook create-rds-oracle.yml

You can now see your Oracle RDS instance via the console or you can use AWS CLI command to list RDS instances in your account.