Bug 2168022

Summary: ansible-freeipa ipauser add support GECOS field
Product: Red Hat Enterprise Linux 8 Reporter: Sunny Wu <suwu>
Component: ansible-freeipaAssignee: Rafael Jeffman <rjeffman>
Status: CLOSED ERRATA QA Contact: Varun Mylaraiah <mvarun>
Severity: low Docs Contact:
Priority: unspecified    
Version: 8.7CC: amore, mvarun, rjeffman, twoerner
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: ansible-freeipa-1.11.1-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2169372 (view as bug list) Environment:
Last Closed: 2023-11-14 15:26:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2169372    

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

Comment 11 errata-xmlrpc 2023-11-14 15:26:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (ansible-freeipa bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:6926