It's good that you want to separate your data from your logic. It's a design pattern you won't regret, now and going forward. Here's how I see your problem resolved.
---
# oracle_users.yaml
- hosts: oracledb
sudo: yes
tasks:
- name: Create our (active) groups
group: name={{item.name}} state={{item.state}}
with_items: oracle_groups
- name: Create our (active) users
user: name={{item.name}} state={{item.state}}
with_items: oracle_users
And our actual data, which defines our groups and users. Keep in mind this file is being utilised in an important way: it's going into 'group_vars/'. As you're likely grouping up your hosts in your inventory file, this means you can easily apply a default, "global" configuration to all systems in that group, using group_vars. If you have just one Oracle server you want the users to exist on, however, then you can just move the data to host_vars/, and call the file the same name as the host's hostname in the inventory. Don't include any extensions, such as .yaml, to the file.
# oracledb
oracle_groups:
- name: oracle_users
state: present
- name: oracle_admins
state: present
oracle_users:
- name: oracle_user_1
state: present
groups:
- oracle_users
- oracle_admins
- name: oracle_user_2
state: present
groups:
- oracle_user
And our inventory file, for a complete example. Note I'm using Vagrant locally, so this is how it looks for me. These files are a complete working example with a simple, practically default, Vagrantfile.
[oracledb]
localdev ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222 ansible_ssh_user=vagrant ansible_ssh_private_key_file=~/.vagrant.d/insecure_private_key
Overall you should be using 'group_vars/all' to define truly global data state that applies to everything in your estate. This is a great place to define the default users that can SSH into your systems, like sysads, as well as other handy features such as a base set of packages that must be installed, etc. If you need to override these settings, then you can use 'group_vars/$group_name' and 'host_vars/$host_name'.
You can also change the 'hash_behaviour' from the default of 'replace' to 'merge', which means as you work your way close to a specific host's configuration, hashes and arrays can have their values overridden OR new values introduced, those allowing you to merge global configuration with more host or group specific configuration. An example of this might be merging the global users from 'group_vars/all' with your Oracle users (from above) in 'group_vars/oracledb'.
I hope this makes helps. If you have any questions, let me know.
- M