# Configure multiple oracle instances in a loop

**URL:** <https://forum.ansible.com/t/configure-multiple-oracle-instances-in-a-loop/27269>\
**Category:** Ansible Project\
**Created:** [April 13, 2018, 1:49am UTC](https://forum.ansible.com/t/configure-multiple-oracle-instances-in-a-loop/27269 "2018-04-13T01:49:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christopher\_Priest](https://avatars.discourse-cdn.com/v4/letter/c/85e7bf/32.png) [@Christopher\_Priest](https://forum.ansible.com/u/Christopher_Priest)\
**Post date:** [April 13, 2018, 1:49am UTC](https://forum.ansible.com/t/configure-multiple-oracle-instances-in-a-loop/27269/1 "2018-04-13T01:49:16Z")

</div>

Hi There,

I have set up a playbook and two roles →

1. The first role sets up the Linux kernel and OS
2. The second role installs the Oracle software WITH a listener but WITHOUT any instance. This role has checks to terminate if Oracle is already installed

I am now wanting to set up a role to install multiple Oracle instances ( DEV TEST UAT RCAT etc). I get stuck with the fact that each instance has a different port number for enterprise manager. eg (DEV 5500, TEST 5501 etc). So far, the only way I can see to do this is to not have a common dbca.rsp file but rather have one per instance with the port number hard coded. Also, I want to ensure that prior to attempting to create a database, that the instance being created doesn’t already exist. Is this possible while looping?

Regards

Chris

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [April 16, 2018, 12:35pm UTC](https://forum.ansible.com/t/configure-multiple-oracle-instances-in-a-loop/27269/2 "2018-04-16T12:35:02Z")

</div>

Here’s some ideas

You can define a host variable in your ansible inventory file, like this

`
