Bug 2168022 - ansible-freeipa ipauser add support GECOS field
Summary: ansible-freeipa ipauser add support GECOS field
Keywords:
Status: VERIFIED
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: ansible-freeipa
Version: 8.7
Hardware: All
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Rafael Jeffman
QA Contact: Varun Mylaraiah
URL:
Whiteboard:
Depends On:
Blocks: 2169372
TreeView+ depends on / blocked
 
Reported: 2023-02-08 03:27 UTC by Sunny Wu
Modified: 2023-08-02 08:59 UTC (History)
4 users (show)

Fixed In Version: ansible-freeipa-1.11.1-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2169372 (view as bug list)
Environment:
Last Closed:
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker FREEIPA-9416 0 None None None 2023-02-08 03:28:45 UTC
Red Hat Issue Tracker RHELPLAN-147883 0 None None None 2023-02-08 03:28:48 UTC

Description Sunny Wu 2023-02-08 03:27:39 UTC
Description of problem:

ipauser module is not able to add gecos field:

~~~
- name: Playbook to handle users
  hosts: ipaserver
  become: true

  tasks:
  - ipauser:
      ipaadmin_password: '{{ ipaadmin_password }}'
      name: user1
      first: UserFirst
      last: UserLast
      phone: "+1234567890"
      email: user1
      password: "mypassword"
      gecos: UserFirst            <<<<<=====
      update_password: on_create
~~~
~~~
fatal: [<...>]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (ipauser) module: gecos. Supported parameters include: phone (telephonenumber), nomembers, preserve, radius (ipatokenradiusconfiglink), userclass (class), mobile, manager, preferredlanguage, shell (loginshell), update_password, principalexpiration (krbprincipalexpiration), userauthtype (ipauserauthtype), title, userstate (st), noprivate, state, users, ipaadmin_password, name (login), passwordexpiration (krbpasswordexpiration), certificate (usercertificate), certmapdata, displayname, password, employeenumber, random, carlicense, ipaadmin_principal, radiususer (ipatokenradiususername, radiususername), last (sn), ipaapi_context, city, gid (gidnumber), homedir, email, departmentnumber, pager, uid (uidnumber), initials, employeetype, fax (facsimiletelephonenumber), sshpubkey (ipasshpubkey), first (givenname), action, principal (krbprincipalname, principalname), postalcode (zip), ipaapi_ldap_cache, orgunit (ou), fullname (cn)."}
~~~

The field is not in source code in v1.9.2 

https://github.com/freeipa/ansible-freeipa/blob/v1.9.2/plugins/modules/ipauser.py

-----

This field is supported in command line:

~~~
$ ipa user-add -h
Usage: ipa [global-options] user-add LOGIN [options]

Add a new user.
Options:
  -h, --help            show this help message and exit
  --first=STR           First name
  --last=STR            Last name
  --cn=STR              Full name
  --displayname=STR     Display name
  --initials=STR        Initials
  --homedir=STR         Home directory
  --gecos=STR           GECOS        <<<<<=====
  --shell=STR           Login shell
~~~

Comment 2 Rafael Jeffman 2023-02-13 17:53:40 UTC
Upstream PR: https://github.com/freeipa/ansible-freeipa/pull/1039

Comment 8 Varun Mylaraiah 2023-08-02 08:58:53 UTC
Verified

ansible-core-2.15.1-1.el8.x86_64
ansible-freeipa-1.11.1-1.el8.noarch

PASSED ansible_freeipa_tests/user/test_user.py::TestUserModule::test_user_add_with_gecos
PASSED ansible_freeipa_tests/user/test_user.py::TestUserModule::test_user_update_gecos_field
PASSED ansible_freeipa_tests/user/test_user.py::TestUserModule::test_user_reset_gecos_field
PASSED ansible_freeipa_tests/user/test_user.py::TestUserModule::test_user_add_gecos_with_unicode_char


Based on the above test result, marking the bug Verified


Note You need to log in before you can comment on or make changes to this bug.