Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

win_user module fails if the windows account has already been disabled #4369

Closed
ahuffman opened this issue Aug 9, 2016 · 3 comments
Closed

Comments

@ahuffman
Copy link

ahuffman commented Aug 9, 2016

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_user.ps1

ANSIBLE VERSION
ansible 2.1.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
CONFIGURATION
OS / ENVIRONMENT
SUMMARY

Recieving an error message after attempting to enable a disabled account:
FAILED! => {"changed": false, "failed" true, "msg": "Exception calling "Validate Credentials" with "2" argument(s): "This user can't sign in because this account is currently disabled.\r\n""}

STEPS TO REPRODUCE

1.) I created a Windows user using win_user module

  • name: Add Windows Admin User
    win_user:
    name: ansible
    password: my_obscured_pass1
    password_never_expires: yes
    update_password: always
    state: present
    user_cannot_change_password: yes
    groups: Administrators
    groups_action: add
    fullname: "Ansible Test User"
    description: "An account for testing with Ansible

2.) I used win_user module to disable the account
win_user:
name: ansible
state: present
account_disabled: yes

3.) I tried to use win_user module like in the first step, but added the account_disabled: no and account_locked: no parameters to attempt to reenable the account.

  • name: Add Windows Admin User
    win_user:
    name: ansible
    password: my_obscured_pass1
    password_never_expires: yes
    update_password: always
    account_disabled: no
    account_locked: no
    state: present
    user_cannot_change_password: yes
    groups: Administrators
    groups_action: add
    fullname: "Ansible Test User"
    description: "An account for testing with Ansible

EXPECTED RESULTS

I expected the user account to be enabled after being disabled as well as unlocked if it were locked out.

ACTUAL RESULTS
FAILED! => {"changed": false, "failed" true, "msg": "Exception calling \"Validate Credentials\" with \"2\" argument(s): \"This user can't sign in because this account is currently disabled.\r\n\""}
@ahuffman ahuffman changed the title win_user module fails if account has been disabled win_user module fails if the windows account has already been disabled Aug 9, 2016
@ansibot
Copy link

ansibot commented Aug 9, 2016

@nitzmahone ping, this issue is waiting for your response.
click here for bot help

@ansibot
Copy link

ansibot commented Sep 8, 2016

@nitzmahone, ping. This issue is still waiting on your response.
click here for bot help

@nitzmahone nitzmahone added the P2 label Sep 9, 2016
@nitzmahone nitzmahone added this to the stable-2.1 milestone Sep 9, 2016
@nitzmahone nitzmahone self-assigned this Sep 9, 2016
nitzmahone added a commit to ansible/ansible that referenced this issue Sep 12, 2016
Ensure ansible/ansible-modules-core#4369 doesn't occur again, also adds tests for password set when expired.
nitzmahone added a commit that referenced this issue Sep 12, 2016
Disabled and password-expired accounts cannot call ValidatePassword successfully

fixed #4369

(cherry picked from commit 1a0e150)
nitzmahone added a commit to ansible/ansible that referenced this issue Sep 12, 2016
Ensure ansible/ansible-modules-core#4369 doesn't occur again, also adds tests for password set when expired.

(cherry picked from commit 69880f1)
@nitzmahone
Copy link
Member

Should now be fixed in 2.1.2RC3 and 2.2.

grgi pushed a commit to zaehlwerk/ansible-modules-core that referenced this issue Sep 29, 2016
Disabled and password-expired accounts cannot call ValidatePassword successfully

fixed ansible#4369

(cherry picked from commit 1a0e150)
sereinity pushed a commit to sereinity-forks/ansible that referenced this issue Jan 25, 2017
Ensure ansible/ansible-modules-core#4369 doesn't occur again, also adds tests for password set when expired.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants