[Freeipa-users] Export data

Martin Kosek mkosek at redhat.com
Wed Jan 22 13:30:58 UTC 2014


On 01/22/2014 01:48 PM, Choudhury, Suhail wrote:
> Hi guys,
> 
> I trying to get a dump of all users, hosts and DNS entries from IPA so
> we can run scripts/Puppet against them.
> 
> Tried searching for it but cannot find anything, so was hoping someone
> can give some hints on how best to do this please.
> 

You can either export them via ldapsearch:

$ kinit admin
$ ldapsearch -h `hostname` -Y GSSAPI -b 'cn=users,cn=accounts,dc=example,dc=com'


... or for write a Python script to do what you want. Very simple example:

$ kinit admin
$ python
>>> from ipalib import api
>>> api.bootstrap()
>>> api.finalize()
>>> api.Backend.xmlclient.connect()
>>> users = api.Command.user_find()
>>> for user in users['result']:...     print "%s:%s:%s" % (user['uid'][0],
user['uidnumber'][0], user['gidnumber'][0])
...
admin:1913600000:1913600000
tuser:1913600001:1913600001


Martin




More information about the Freeipa-users mailing list