# How to use the DarwinUser class from the user module?

**URL:** <https://forum.ansible.com/t/how-to-use-the-darwinuser-class-from-the-user-module/19135>\
**Category:** Ansible Project\
**Created:** [August 28, 2015, 5:44am UTC](https://forum.ansible.com/t/how-to-use-the-darwinuser-class-from-the-user-module/19135 "2015-08-28T05:44:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vineet\_Naik](https://avatars.discourse-cdn.com/v4/letter/v/96bed5/32.png) [@Vineet\_Naik](https://forum.ansible.com/u/Vineet_Naik)\
**Post date:** [August 28, 2015, 5:44am UTC](https://forum.ansible.com/t/how-to-use-the-darwinuser-class-from-the-user-module/19135/1 "2015-08-28T05:44:00Z")

</div>

Hello,

I am trying to extend a custom role that involves creating and setting up user accounts to work on MacOSX. After looking at the source code of the user module, I found the DarwinUser subclass defined ([https://github.com/ansible/ansible-modules-core/blob/devel/system/user.py#L1396](https://github.com/ansible/ansible-modules-core/blob/devel/system/user.py#L1396)). But the main function just initializes an object of the User class. Is it possible to tell the module to use the DarwinUser class instead of User? What’s the recommended way to use the subclasses that are defined?

Thanks,  
Vineet

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [August 28, 2015, 2:19pm UTC](https://forum.ansible.com/t/how-to-use-the-darwinuser-class-from-the-user-module/19135/2 "2015-08-28T14:19:21Z")

</div>

That happens automatically when running on OS X:  
[https://github.com/ansible/ansible-modules-core/blob/devel/system/user.py#L249](https://github.com/ansible/ansible-modules-core/blob/devel/system/user.py#L249)  
[https://github.com/ansible/ansible/blob/devel/lib/ansible/module\_utils/basic.py#L224](https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/basic.py#L224)

---

<div class="post-metadata">

**Author:** ![Vineet\_Naik](https://avatars.discourse-cdn.com/v4/letter/v/96bed5/32.png) [@Vineet\_Naik](https://forum.ansible.com/u/Vineet_Naik)\
**Post date:** [August 30, 2015, 6:07pm UTC](https://forum.ansible.com/t/how-to-use-the-darwinuser-class-from-the-user-module/19135/3 "2015-08-30T18:07:54Z")

</div>

Ok, just realized that the DarwinUser subclass has been added in relatively newer version of ansible where as we are using an older version in which the subclass doesn’t exist which is the reason why the module didn’t work automatically.

Thanks.
