Skip to content

Ansible Dynamic Inventory for Oracle Enterprise Manager

License

Notifications You must be signed in to change notification settings

lucaslellis/ansible_oem_dynamic_inventory

Repository files navigation

Ansible Dynamic Inventory for Oracle Enterprise Manager

A python script to generate an Ansible inventory based on an Oracle Enterprise Manager (OEM) repository database.

Based on an example of the book Ansible for DevOps.

Validated against OEM 13.4.

Groups are dynamically created based on the following properties:

  • Repository name (section name in the config.ini file)
  • Lifecycle Status
  • Line of Business
  • Operating System family (e.g.: AIX, Linux, Windows)
  • Operating System version (e.g.: Windows Server 2012 Enterprise, Oracle Linux 6.4, Oracle Linux 7.9)

Requirements

  • Python 3.x
  • cx_Oracle
  • Oracle Client or Oracle Database installed on the same host
  • Repository User Privileges:
    • select on "REPOSITORY_OWNER".mgmt$target
    • select on "REPOSITORY_OWNER".mgmt$target_properties
    • Synonyms for "REPOSITORY_OWNER".mgmt$target and "REPOSITORY_OWNER".mgmt$target_properties

Instructions

  • Ensure that the packages python3 and python3-pip are installed (RHEL 7.x / OEL 7.x).
  • Install cx_Oracle with pip3. If you don't have root access, a local install for your user is enough.
pip3 install -U cx_Oracle --user

Validation

./ansible_oem_inventory.py --list

ansible all -i ./ansible_oem_inventory.py -m ping