Skip to content

Example of configuring oradb_manage_tablespace role #322

@talek

Description

@talek

Hello,

Is there any example of how to configure oradb_manage_tablespace role? This is the playbook I'm playing around with:

---
- name: Tablespace setup
  hosts: "{{ hostgroup | default('all')}}"
  become: true
  vars:
    dbpasswords:
      MOLDB:
        sys: "Manager123!"
        system: "Manager123!"
    db_homes_config:
      19c:
        home: 19c
        oracle_home: /u01/app/oracle/product/19c/ee_db
        version: 19.3.0.0
        edition: EE
    oracle_databases:
      - home: 19c
        oracle_db_name: MOLDB
        is_container: false
        state: present
        tablespaces:
          - name: perfstat_tbs
            size: 10M
            autoextend: true
            next: 50M
            maxsize: 4G
            content: permanent
            state: present
            bigfile: false
            datafile: "/data/oradata/MOLDB/perfstat01.dbf"
  tasks:
    - name: Provision tablespaces
      ansible.builtin.include_role:
        name: opitzconsulting.ansible_oracle.oradb_manage_tablespace

The error I get is:

TASK [opitzconsulting.ansible_oracle.oradb_manage_tablespace : Manage tablespaces (db/cdb)] ***
Wednesday 15 February 2023  18:32:53 +0200 (0:00:00.078)       0:00:04.163 ****
fatal: [molecule]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'db_password_cdb' is undefined\n\nThe error appears to be in '/Users/talek/.ansible/collections/ansible_collections/opitzconsulting/ansible_oracle/roles/oradb_manage_tablespace/tasks/main.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: Manage tablespaces (db/cdb)\n  ^ here\n"}

I can define db_password_cdb variable, but most likely I need to come up with some logic to get it out of dbpasswords variable, especially if I have more than one database entry defined in oracle_databases. But that's not all. I also need to play smart with the oracle home if it happens to have more homes in the db_homes_config.

Any pointers in the right direction?
Thank you!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions