A minimal playbook
---
# vim: set filetype=ansible ff=unix ts=2 sw=2 ai expandtab :
#
# Playbook to configure the environment
- hosts: createuser
tasks:
- name: create user
run_once: true
win_user:
name: gary
password: 'B0bP4ssw0rd123!^'
password_never_expires: true
account_disabled: no
account_locked: no
password_expired: no
state: present
groups:
- Administrators
- Users
When I run first time I get:
PLAY [createuser] ************************
TASK [Gathering Facts] *******************
ok: [dsy-demo-mssql02]
TASK [create user] ***********************
changed: [dsy-demo-mssql02]
PLAY RECAP *******************************
dsy-demo-mssql02 : ok=2 changed=1 unreachable=0 failed=0
When I re-run, I get:
PLAY [createuser] ************************
TASK [Gathering Facts] *******************
ok: [dsy-demo-mssql02]
TASK [create user] ***********************
fatal: [dsy-demo-mssql02]: FAILED! => {“changed”: false, “failed”: true, “msg”: “Exception calling "ValidateCredentials" with "2" argument(s): "The network path was not found.\r\n"”}
NO MORE HOSTS LEFT ***********************
to retry, use: --limit @/root/ansible_windows/createuser-playbook.retry
PLAY RECAP *******************************
dsy-demo-mssql02 : ok=1 changed=0 unreachable=0 failed=1
Just trying to work out if there is anything obvious I could be doing wrong.
I have verified that I can login to the created account.
verbose output is not much different:
TASK [create user] *********************************
task path: /root/ansible_windows/createuser-playbook.yml:9
Using module file /usr/lib/python2.6/site-packages/ansible/modules/windows/win_user.ps1
ESTABLISH WINRM CONNECTION FOR USER: local\Administrator on PORT 5986 TO dsy-demo-mssql02
EXEC (via pipeline wrapper)
fatal: [dsy-demo-mssql02]: FAILED! => {
“changed”: false,
“failed”: true,
“msg”: “Exception calling "ValidateCredentials" with "2" argument(s): "The network path was not found.\r\n"”
}