oravirt / ansible-oracle-modules

Oracle modules for Ansible
MIT License
214 stars 160 forks source link

oracle_user module - parameter 'state' #75

Closed nalokin closed 5 years ago

nalokin commented 6 years ago

Hi,

as per documentation state parameter is:

    required: False
    default: present
    choices: ['present','absent','locked','unlocked']

If we pass parameter locked or unlocked and user is not present user will be created. This would mean that 'unlocked' is redundant as it has the same function as 'present'. Does it make sense to throw an error when user doesn't exist.

For example let's say we would like to automate that users can unlock themselves without admins have to log in and do it for them. If we use that parameter users would get instantaneous access to the DB without ever been granted one.

Also to the same point should there be 'expired' option in there so that user gets created as expired and is forced to change password on the next login.

Thank you. n.

oravirt commented 6 years ago

Adding expired as on option shouldn't be a problem

If the user doesn't exist could just exit with a message to that effect.

oravirt commented 6 years ago

https://github.com/oravirt/ansible-oracle-modules/commit/5a57f74e30e2175a5ce0a75e67d8d7971aef0614 should address this

nalokin commented 6 years ago

Fantastic. Will test out and update.

nalokin commented 5 years ago

Great. Works as expected. When state unlocked and user does not exists it throws an error. When user is expired it creates the user as expired.

I would suggest documentation update with new status.

state:
    description:
        - Whether the user should exist. 
        - Absent removes the user, locked/unlocked locks or unlocks the user, expire, expires the user.
        - If user does not exists and state is 'unlocked' it will throw an error "The schema schema1 doesn't exist"
    required: False
    default: present
    choices: ['present','absent','locked','unlocked','expire']

Or if you want I can pull the code and update it. I just thought this is easier\quicker.

Thanks. -N.