Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oracle_tablespaces seems to dislike OMF #2

Open
ZeFrenchBibster opened this issue Nov 3, 2021 · 1 comment
Open

oracle_tablespaces seems to dislike OMF #2

ZeFrenchBibster opened this issue Nov 3, 2021 · 1 comment

Comments

@ZeFrenchBibster
Copy link

Hi,

As we're using OFM all over the place, I run into the following issue:

when running this task for the second time, it breaks, because the original datafile, created at the initial run, is not in the list of 'wanted' datafilee, and then tries to delete it:

tasks:

  • name: Create tablespace
    ari_stark.ansible_oracle_modules.oracle_tablespace: hostname={{ hostname }} service_name={{ service_name }} user={{ user }} password={{ password }}
    tablespace={{ tablespace_name }} content={{ content }} bigfile={{ bigfile }} state={{ state }} size={{ size }}

May it should 'detect' OMF and ignore the datafiles bit? (My table spaces get new datafilee whenever the Cloud control sees they reach 85%, so I won't use Ansible to 'add datafiles')

Kins regards,

P.

@ZeFrenchBibster
Copy link
Author

Update:
Here's what AWX comes up with when I run the playbook for the 2nd time: (Playbook is below)

All is delegated to localhost, as the oracle modules are not installed locally on all my DB-servers, but just on the ansible workers.

{
"msg": "ORA-03261: the tablespace ANSIBLE_TEST has only one file",
"code": 3261,
"request": "alter tablespace ANSIBLE_TEST drop datafile '/u02/app/oracle/oradata/datastore/.ACFS/snaps/T12RLFXB/T12RLFXB/datafile/o1_mf_ansible__jr779w83_.dbf'",
"ddls": [],
"invocation": {
"module_args": {
"hostname": "blmoda02-1.ndl.norbert-dentressangle.com",
"service_name": "T12RLFXB",
"user": "sys",
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"mode": "sysdba",
"tablespace": "ANSIBLE_TEST",
"content": "permanent",
"bigfile": false,
"state": "present",
"size": "1G",
"username": "sys",
"autoextend": false,
"datafiles": [],
"default": false,
"port": 1521,
"read_only": false,
"maxsize": null,
"oracle_home": null,
"nextsize": null
}
},
"_ansible_no_log": false,
"changed": false,
"_ansible_delegated_vars": {
"ansible_host": "localhost"
}
}


  • hosts: all
    gather_facts: no
    vars:
    user: "sys"
    password: "{{ sysdba_password }}"
    mode: "sysdba"

    tasks:

    • name: Create tablespace
      delegate_to: localhost
      ari_stark.ansible_oracle_modules.oracle_tablespace:
      hostname: "{{ hostname }}"
      service_name: "{{ service_name }}"
      user: "{{ user }}"
      password: "{{ password }}"
      mode: "{{ mode }}"
      tablespace: "{{ new_username }}"
      content: permanent
      bigfile: no
      state: present
      size: 1G
    • name: Create User
      delegate_to: localhost
      ari_stark.ansible_oracle_modules.oracle_user:
      hostname: "{{ hostname }}"
      service_name: "{{ service_name }}"
      user: "{{ user }}"
      password: "{{ password }}"
      mode: "{{ mode }}"
      schema_name: "{{ new_username }}"
      schema_password: "{{ new_password }}"
      state: present
      default_tablespace: "{{ new_username }}"
      profile: DEFAULT
    • name: Grant roles and object privs
      delegate_to: localhost
      ari_stark.ansible_oracle_modules.oracle_grant:
      hostname: "{{ hostname }}"
      service_name: "{{ service_name }}"
      username: "{{ user }}"
      password: "{{ password }}"
      mode: "{{ mode }}"
      grantee: "{{ new_username }}"
      state: present
      privileges:
      - "UNLIMITED TABLESPACE"
      - "CONNECT"
      - "RESOURCE"
      - "AQ_ADMINISTRATOR_ROLE"
      - "AQ_USER_ROLE"
      - "CREATE PROCEDURE"
      - "CREATE VIEW"
      objects_privileges:
      SYS.V_$LOCK:
      - "select"
      SYS.V_$LOCKED_OBJECT:
      - "select"
      SYS.ALL_OBJECTS:
      - "select"
      SYS.V_$SESSION:
      - "select"
      SYS.V_$DATABASE:
      - "select"
      SYS.GV_$LOCK:
      - "select"
      SYS.GV_$LOCKED_OBJECT:
      - "select"
      SYS.GV_$SESSION:
      - "select"
      SYS.GV_$INSTANCE:
      - "select"
      SYS.DBMS_SHARED_POOL:
      - "execute"
      DBMS_AQADM:
      - "execute"
      DBMS_AQ:
      - "execute"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant