Manages Windows Active Directory user accounts
- Manages Windows Active Directory user accounts.
Note
- Works with Windows 2012R2 and newer.
- If running on a server that is not a Domain Controller, credential delegation through CredSSP or Kerberos with delegation must be used or the domain_username, domain_password must be set.
- Note that some individuals have confirmed successful operation on Windows 2008R2 servers with AD and AD Web Services enabled, but this has not received the same degree of testing as Windows 2012R2.
.. seealso:: :ref:`ansible.windows.win_domain_module` The official documentation on the **ansible.windows.win_domain** module. :ref:`ansible.windows.win_domain_controller_module` The official documentation on the **ansible.windows.win_domain_controller** module. :ref:`community.windows.win_domain_computer_module` The official documentation on the **community.windows.win_domain_computer** module. :ref:`community.windows.win_domain_group_module` The official documentation on the **community.windows.win_domain_group** module. :ref:`ansible.windows.win_domain_membership_module` The official documentation on the **ansible.windows.win_domain_membership** module. :ref:`ansible.windows.win_user_module` The official documentation on the **ansible.windows.win_user** module. :ref:`community.windows.win_user_profile_module` The official documentation on the **community.windows.win_user_profile** module.
- name: Ensure user bob is present with address information
community.windows.win_domain_user:
name: bob
firstname: Bob
surname: Smith
company: BobCo
password: B0bP4ssw0rd
state: present
groups:
- Domain Admins
street: 123 4th St.
city: Sometown
state_province: IN
postal_code: 12345
country: US
attributes:
telephoneNumber: 555-123456
- name: Ensure user bob is created and use custom credentials to create the user
community.windows.win_domain_user:
name: bob
firstname: Bob
surname: Smith
password: B0bP4ssw0rd
state: present
domain_username: DOMAIN\admin-account
domain_password: SomePas2w0rd
domain_server: [email protected]
- name: Ensure user bob is present in OU ou=test,dc=domain,dc=local
community.windows.win_domain_user:
name: bob
password: B0bP4ssw0rd
state: present
path: ou=test,dc=domain,dc=local
groups:
- Domain Admins
- name: Ensure user bob is absent
community.windows.win_domain_user:
name: bob
state: absent
- name: Ensure user has spn's defined
community.windows.win_domain_user:
name: liz.kenyon
spn:
- MSSQLSvc/us99db-svr95:1433
- MSSQLSvc/us99db-svr95.vmware.com:1433
- name: Ensure user has spn added
community.windows.win_domain_user:
name: liz.kenyon
spn_action: add
spn:
- MSSQLSvc/us99db-svr95:2433
- name: Ensure user is created with delegates and spn's defined
community.windows.win_domain_user:
name: shmemmmy
password: The3rubberducki33!
state: present
groups:
- Domain Admins
- Enterprise Admins
delegates:
- CN=shenetworks,CN=Users,DC=ansible,DC=test
- CN=mk.ai,CN=Users,DC=ansible,DC=test
- CN=jessiedotjs,CN=Users,DC=ansible,DC=test
spn:
- MSSQLSvc/us99db-svr95:2433
Common return values are documented here, the following are the fields unique to this module:
- Nick Chandler (@nwchandler)
- Joe Zollo (@zollo)