ansible-collections / community.windows

Windows community collection for Ansible
https://galaxy.ansible.com/community/windows
GNU General Public License v3.0
198 stars 153 forks source link

There is no "office" parameter for creating a new AD user. #486

Closed Jeroenvb3 closed 1 year ago

Jeroenvb3 commented 1 year ago
SUMMARY

There is no office field parameter. There is an office field in AD itself.

ISSUE TYPE
COMPONENT NAME

win_domain_user

ANSIBLE VERSION
ansible [core 2.13.4]
  config file = /root/ansible/vmware_lab_rollout/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /root/.local/lib/python3.9/site-packages/ansible
  ansible collection location = /root/ansible/vmware_lab_rollout/collections
  executable location = /usr/bin/ansible
  python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
# /usr/lib/python3/dist-packages/ansible_collections
Collection        Version
----------------- -------
community.windows 1.10.0

# /root/.local/lib/python3.9/site-packages/ansible_collections
Collection        Version
----------------- -------
community.windows 1.11.0

# /root/ansible/vmware_lab_rollout/collections/ansible_collections
Collection        Version
----------------- -------
community.windows 1.12.0
CONFIGURATION
COLLECTIONS_PATHS(/root/ansible/vmware_lab_rollout/ansible.cfg) = ['/root/ansible/vmware_lab_rollout/collections']
INVENTORY_ENABLED(/root/ansible/vmware_lab_rollout/ansible.cfg) = ['host_list', 'script', 'auto', 'yaml', 'ini', 'toml', 'community.vmware.vmware_vm_inventory']
OS / ENVIRONMENT

It is on a Debian system.

STEPS TO REPRODUCE

Create a playbook with a win_domain_user task that has the office field.

- name: Add user with office field
  community.windows.win_domain_user:
    name: "name"
    state: present
    office: "anofficevalue"
EXPECTED RESULTS

A user created with an office field in AD.

ACTUAL RESULTS

Office is not a valid parameter.

fatal: [VM]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (community.windows.win_domain_user) module: office. Supported parameters include: password_expired, groups_missing_behaviour, display_name, identity, street, domain_password, update_password, delegates, state, country, password_never_expires, groups_action, domain_username, enabled, account_locked, name, description, email, postal_code, spn_action, firstname, groups, path, city, attributes, company, password, domain_server, sam_account_name, surname, user_cannot_change_password, upn, spn, state_province, principals_allowed_to_delegate, lastname, spns"}
hiyokotaisa commented 1 year ago

Thank you for raising issue on community.windows!

We have new windows collections named microsoft.ad and all of Active Directory related modules are moved into that collection. Also, bugfixes and new features will be implemented for new collection.

If you are still seeing same issue of win_domain_user, could you create new issue on https://github.com/ansible-collections/microsoft.ad ?

Thank you for your understanding.

jborean93 commented 1 year ago

The win_domain_user module has been deprecated by https://github.com/ansible-collections/community.windows/pull/516 in favour of microsoft.ad.user. See the migration guide for more info on how to change your code to use the newer module.

In this case microsoft.ad.user can be used to change any LDAP attributes on the user object, it would look like

- microsoft.ad.user:
    name: name
    state: present
    attributes:
      set:
        office: anofficevalue