mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-07-31 03:44:41 +00:00
Merge pull request #1044 from rjeffman/ipauser_street
ipauser: Add support for parameter "street"
This commit is contained in:
@@ -397,6 +397,7 @@ Variable | Description | Required
|
|||||||
`uid` \| `uidnumber` | User ID Number (system will assign one if not provided). | no
|
`uid` \| `uidnumber` | User ID Number (system will assign one if not provided). | no
|
||||||
`gid` \| `gidnumber` | Group ID Number. | no
|
`gid` \| `gidnumber` | Group ID Number. | no
|
||||||
`gecos` | GECOS | no
|
`gecos` | GECOS | no
|
||||||
|
`street` | Street address | no
|
||||||
`city` | City | no
|
`city` | City | no
|
||||||
`userstate` \| `st` | State/Province | no
|
`userstate` \| `st` | State/Province | no
|
||||||
`postalcode` \| `zip` | Postalcode/ZIP | no
|
`postalcode` \| `zip` | Postalcode/ZIP | no
|
||||||
@@ -444,3 +445,4 @@ Authors
|
|||||||
=======
|
=======
|
||||||
|
|
||||||
Thomas Woerner
|
Thomas Woerner
|
||||||
|
Rafael Jeffman
|
||||||
|
|||||||
@@ -137,6 +137,10 @@ options:
|
|||||||
type: int
|
type: int
|
||||||
required: false
|
required: false
|
||||||
aliases: ["gidnumber"]
|
aliases: ["gidnumber"]
|
||||||
|
street:
|
||||||
|
description: Street address
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
city:
|
city:
|
||||||
description: City
|
description: City
|
||||||
type: str
|
type: str
|
||||||
@@ -365,6 +369,10 @@ options:
|
|||||||
type: int
|
type: int
|
||||||
required: false
|
required: false
|
||||||
aliases: ["gidnumber"]
|
aliases: ["gidnumber"]
|
||||||
|
street:
|
||||||
|
description: Street address
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
city:
|
city:
|
||||||
description: City
|
description: City
|
||||||
type: str
|
type: str
|
||||||
@@ -662,10 +670,11 @@ def find_user(module, name):
|
|||||||
|
|
||||||
def gen_args(first, last, fullname, displayname, initials, homedir, gecos,
|
def gen_args(first, last, fullname, displayname, initials, homedir, gecos,
|
||||||
shell, email, principalexpiration, passwordexpiration, password,
|
shell, email, principalexpiration, passwordexpiration, password,
|
||||||
random, uid, gid, city, userstate, postalcode, phone, mobile,
|
random, uid, gid, street, city, userstate, postalcode, phone,
|
||||||
pager, fax, orgunit, title, carlicense, sshpubkey, userauthtype,
|
mobile, pager, fax, orgunit, title, carlicense, sshpubkey,
|
||||||
userclass, radius, radiususer, departmentnumber, employeenumber,
|
userauthtype, userclass, radius, radiususer, departmentnumber,
|
||||||
employeetype, preferredlanguage, noprivate, nomembers):
|
employeenumber, employeetype, preferredlanguage, noprivate,
|
||||||
|
nomembers):
|
||||||
# principal, manager, certificate and certmapdata are handled not in here
|
# principal, manager, certificate and certmapdata are handled not in here
|
||||||
_args = {}
|
_args = {}
|
||||||
if first is not None:
|
if first is not None:
|
||||||
@@ -698,6 +707,8 @@ def gen_args(first, last, fullname, displayname, initials, homedir, gecos,
|
|||||||
_args["uidnumber"] = to_text(str(uid))
|
_args["uidnumber"] = to_text(str(uid))
|
||||||
if gid is not None:
|
if gid is not None:
|
||||||
_args["gidnumber"] = to_text(str(gid))
|
_args["gidnumber"] = to_text(str(gid))
|
||||||
|
if street is not None:
|
||||||
|
_args["street"] = street
|
||||||
if city is not None:
|
if city is not None:
|
||||||
_args["l"] = city
|
_args["l"] = city
|
||||||
if userstate is not None:
|
if userstate is not None:
|
||||||
@@ -746,39 +757,31 @@ def gen_args(first, last, fullname, displayname, initials, homedir, gecos,
|
|||||||
def check_parameters( # pylint: disable=unused-argument
|
def check_parameters( # pylint: disable=unused-argument
|
||||||
module, state, action, first, last, fullname, displayname, initials,
|
module, state, action, first, last, fullname, displayname, initials,
|
||||||
homedir, gecos, shell, email, principal, principalexpiration,
|
homedir, gecos, shell, email, principal, principalexpiration,
|
||||||
passwordexpiration, password, random, uid, gid, city, phone, mobile,
|
passwordexpiration, password, random, uid, gid, street, city, phone,
|
||||||
pager, fax, orgunit, title, manager, carlicense, sshpubkey,
|
mobile, pager, fax, orgunit, title, manager, carlicense, sshpubkey,
|
||||||
userauthtype, userclass, radius, radiususer, departmentnumber,
|
userauthtype, userclass, radius, radiususer, departmentnumber,
|
||||||
employeenumber, employeetype, preferredlanguage, certificate,
|
employeenumber, employeetype, preferredlanguage, certificate,
|
||||||
certmapdata, noprivate, nomembers, preserve, update_password):
|
certmapdata, noprivate, nomembers, preserve, update_password):
|
||||||
invalid = []
|
if state == "present" and action == "user":
|
||||||
if state == "present":
|
invalid = ["preserve"]
|
||||||
if action == "member":
|
|
||||||
invalid = ["first", "last", "fullname", "displayname", "initials",
|
|
||||||
"homedir", "gecos", "shell", "email",
|
|
||||||
"principalexpiration",
|
|
||||||
"passwordexpiration", "password", "random", "uid",
|
|
||||||
"gid", "city", "phone", "mobile", "pager", "fax",
|
|
||||||
"orgunit", "title", "carlicense", "sshpubkey",
|
|
||||||
"userauthtype", "userclass", "radius", "radiususer",
|
|
||||||
"departmentnumber", "employeenumber", "employeetype",
|
|
||||||
"preferredlanguage", "noprivate", "nomembers",
|
|
||||||
"preserve", "update_password"]
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
invalid = ["first", "last", "fullname", "displayname", "initials",
|
invalid = [
|
||||||
"homedir", "gecos", "shell", "email", "principalexpiration",
|
"first", "last", "fullname", "displayname", "initials", "homedir",
|
||||||
"passwordexpiration", "password", "random", "uid",
|
"shell", "email", "principalexpiration", "passwordexpiration",
|
||||||
"gid", "city", "phone", "mobile", "pager", "fax",
|
"password", "random", "uid", "gid", "street", "city", "phone",
|
||||||
"orgunit", "title", "carlicense", "sshpubkey",
|
"mobile", "pager", "fax", "orgunit", "title", "carlicense",
|
||||||
"userauthtype", "userclass", "radius", "radiususer",
|
"sshpubkey", "userauthtype", "userclass", "radius", "radiususer",
|
||||||
"departmentnumber", "employeenumber", "employeetype",
|
"departmentnumber", "employeenumber", "employeetype",
|
||||||
"preferredlanguage", "noprivate", "nomembers",
|
"preferredlanguage", "noprivate", "nomembers", "update_password",
|
||||||
"update_password"]
|
"gecos",
|
||||||
if action == "user":
|
]
|
||||||
invalid.extend(["principal", "manager",
|
|
||||||
"certificate", "certmapdata",
|
if state == "present" and action == "member":
|
||||||
])
|
invalid.append("preserve")
|
||||||
|
else:
|
||||||
|
if action == "user":
|
||||||
|
invalid.extend(
|
||||||
|
["principal", "manager", "certificate", "certmapdata"])
|
||||||
|
|
||||||
if state != "absent" and preserve is not None:
|
if state != "absent" and preserve is not None:
|
||||||
module.fail_json(
|
module.fail_json(
|
||||||
@@ -929,6 +932,7 @@ def main():
|
|||||||
random=dict(type='bool', default=None),
|
random=dict(type='bool', default=None),
|
||||||
uid=dict(type="int", aliases=["uidnumber"], default=None),
|
uid=dict(type="int", aliases=["uidnumber"], default=None),
|
||||||
gid=dict(type="int", aliases=["gidnumber"], default=None),
|
gid=dict(type="int", aliases=["gidnumber"], default=None),
|
||||||
|
street=dict(type="str", default=None),
|
||||||
city=dict(type="str", default=None),
|
city=dict(type="str", default=None),
|
||||||
userstate=dict(type="str", aliases=["st"], default=None),
|
userstate=dict(type="str", aliases=["st"], default=None),
|
||||||
postalcode=dict(type="str", aliases=["zip"], default=None),
|
postalcode=dict(type="str", aliases=["zip"], default=None),
|
||||||
@@ -1046,6 +1050,7 @@ def main():
|
|||||||
random = ansible_module.params_get("random")
|
random = ansible_module.params_get("random")
|
||||||
uid = ansible_module.params_get("uid")
|
uid = ansible_module.params_get("uid")
|
||||||
gid = ansible_module.params_get("gid")
|
gid = ansible_module.params_get("gid")
|
||||||
|
street = ansible_module.params_get("street")
|
||||||
city = ansible_module.params_get("city")
|
city = ansible_module.params_get("city")
|
||||||
userstate = ansible_module.params_get("userstate")
|
userstate = ansible_module.params_get("userstate")
|
||||||
postalcode = ansible_module.params_get("postalcode")
|
postalcode = ansible_module.params_get("postalcode")
|
||||||
@@ -1096,11 +1101,11 @@ def main():
|
|||||||
first, last, fullname, displayname, initials, homedir, gecos, shell,
|
first, last, fullname, displayname, initials, homedir, gecos, shell,
|
||||||
email,
|
email,
|
||||||
principal, principalexpiration, passwordexpiration, password, random,
|
principal, principalexpiration, passwordexpiration, password, random,
|
||||||
uid, gid, city, phone, mobile, pager, fax, orgunit, title, manager,
|
uid, gid, street, city, phone, mobile, pager, fax, orgunit, title,
|
||||||
carlicense, sshpubkey, userauthtype, userclass, radius, radiususer,
|
manager, carlicense, sshpubkey, userauthtype, userclass, radius,
|
||||||
departmentnumber, employeenumber, employeetype, preferredlanguage,
|
radiususer, departmentnumber, employeenumber, employeetype,
|
||||||
certificate, certmapdata, noprivate, nomembers, preserve,
|
preferredlanguage, certificate, certmapdata, noprivate, nomembers,
|
||||||
update_password)
|
preserve, update_password)
|
||||||
certmapdata = convert_certmapdata(certmapdata)
|
certmapdata = convert_certmapdata(certmapdata)
|
||||||
|
|
||||||
# Use users if names is None
|
# Use users if names is None
|
||||||
@@ -1165,6 +1170,7 @@ def main():
|
|||||||
random = user.get("random")
|
random = user.get("random")
|
||||||
uid = user.get("uid")
|
uid = user.get("uid")
|
||||||
gid = user.get("gid")
|
gid = user.get("gid")
|
||||||
|
street = user.get("street")
|
||||||
city = user.get("city")
|
city = user.get("city")
|
||||||
userstate = user.get("userstate")
|
userstate = user.get("userstate")
|
||||||
postalcode = user.get("postalcode")
|
postalcode = user.get("postalcode")
|
||||||
@@ -1194,8 +1200,8 @@ def main():
|
|||||||
ansible_module, state, action,
|
ansible_module, state, action,
|
||||||
first, last, fullname, displayname, initials, homedir,
|
first, last, fullname, displayname, initials, homedir,
|
||||||
gecos, shell, email, principal, principalexpiration,
|
gecos, shell, email, principal, principalexpiration,
|
||||||
passwordexpiration, password, random, uid, gid, city,
|
passwordexpiration, password, random, uid, gid, street,
|
||||||
phone, mobile, pager, fax, orgunit, title, manager,
|
city, phone, mobile, pager, fax, orgunit, title, manager,
|
||||||
carlicense, sshpubkey, userauthtype, userclass, radius,
|
carlicense, sshpubkey, userauthtype, userclass, radius,
|
||||||
radiususer, departmentnumber, employeenumber,
|
radiususer, departmentnumber, employeenumber,
|
||||||
employeetype, preferredlanguage, certificate,
|
employeetype, preferredlanguage, certificate,
|
||||||
@@ -1252,10 +1258,10 @@ def main():
|
|||||||
first, last, fullname, displayname, initials, homedir,
|
first, last, fullname, displayname, initials, homedir,
|
||||||
gecos,
|
gecos,
|
||||||
shell, email, principalexpiration, passwordexpiration,
|
shell, email, principalexpiration, passwordexpiration,
|
||||||
password, random, uid, gid, city, userstate, postalcode,
|
password, random, uid, gid, street, city, userstate,
|
||||||
phone, mobile, pager, fax, orgunit, title, carlicense,
|
postalcode, phone, mobile, pager, fax, orgunit, title,
|
||||||
sshpubkey, userauthtype, userclass, radius, radiususer,
|
carlicense, sshpubkey, userauthtype, userclass, radius,
|
||||||
departmentnumber, employeenumber, employeetype,
|
radiususer, departmentnumber, employeenumber, employeetype,
|
||||||
preferredlanguage, noprivate, nomembers)
|
preferredlanguage, noprivate, nomembers)
|
||||||
|
|
||||||
if action == "user":
|
if action == "user":
|
||||||
|
|||||||
@@ -59,6 +59,7 @@
|
|||||||
#password: foo2
|
#password: foo2
|
||||||
principal: pa
|
principal: pa
|
||||||
random: yes
|
random: yes
|
||||||
|
street: PinkyStreet
|
||||||
city: PinkyCity
|
city: PinkyCity
|
||||||
userstate: PinkyState
|
userstate: PinkyState
|
||||||
postalcode: PinkyZip
|
postalcode: PinkyZip
|
||||||
@@ -86,6 +87,33 @@
|
|||||||
register: result
|
register: result
|
||||||
failed_when: not result.changed or result.failed
|
failed_when: not result.changed or result.failed
|
||||||
|
|
||||||
|
- name: Set street, again
|
||||||
|
ipauser:
|
||||||
|
ipaadmin_password: SomeADMINpassword
|
||||||
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
||||||
|
name: pinky
|
||||||
|
street: PinkyStreet
|
||||||
|
register: result
|
||||||
|
failed_when: result.changed or result.failed
|
||||||
|
|
||||||
|
- name: Clear street attribute.
|
||||||
|
ipauser:
|
||||||
|
ipaadmin_password: SomeADMINpassword
|
||||||
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
||||||
|
name: pinky
|
||||||
|
street: ""
|
||||||
|
register: result
|
||||||
|
failed_when: not result.changed or result.failed
|
||||||
|
|
||||||
|
- name: Clear street attribute, again
|
||||||
|
ipauser:
|
||||||
|
ipaadmin_password: SomeADMINpassword
|
||||||
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
||||||
|
name: pinky
|
||||||
|
street: ""
|
||||||
|
register: result
|
||||||
|
failed_when: result.changed or result.failed
|
||||||
|
|
||||||
- name: User pinky present with changed settings
|
- name: User pinky present with changed settings
|
||||||
ipauser:
|
ipauser:
|
||||||
ipaadmin_password: SomeADMINpassword
|
ipaadmin_password: SomeADMINpassword
|
||||||
|
|||||||
@@ -151,6 +151,7 @@
|
|||||||
#password: foo2
|
#password: foo2
|
||||||
principal: pa
|
principal: pa
|
||||||
random: yes
|
random: yes
|
||||||
|
street: PinkyStreet
|
||||||
city: PinkyCity
|
city: PinkyCity
|
||||||
userstate: PinkyState
|
userstate: PinkyState
|
||||||
postalcode: PinkyZip
|
postalcode: PinkyZip
|
||||||
@@ -194,6 +195,7 @@
|
|||||||
#password: foo2
|
#password: foo2
|
||||||
principal: pa
|
principal: pa
|
||||||
random: yes
|
random: yes
|
||||||
|
street: PinkyStreet
|
||||||
city: PinkyCity
|
city: PinkyCity
|
||||||
userstate: PinkyState
|
userstate: PinkyState
|
||||||
postalcode: PinkyZip
|
postalcode: PinkyZip
|
||||||
|
|||||||
Reference in New Issue
Block a user