Choudhury, Suhail wrote:
Hi Martin,

Thanks for your previous answer.

And how can I export a list of DNS entries using ldapsearch?

He included the basics in his previous answer:

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

You can append the command with the list of attributes you want, and suppress a bunch of the extraneous output with -LLL, so something like:

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


DevOps BSkyB.

From: Martin Kosek []
Sent: 22 January 2014 13:30
To: Choudhury, Suhail;
Subject: Re: [Freeipa-users] Export data

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
users = api.Command.user_find()
for user in users['result']:...     print "%s:%s:%s" % (user['uid'][0],
user['uidnumber'][0], user['gidnumber'][0])


Information in this email including any attachments may be privileged, 
confidential and is intended exclusively for the addressee. The views expressed 
may not be official policy, but the personal views of the originator. If you 
have received it in error, please notify the sender by return e-mail and delete 
it from your system. You should not reproduce, distribute, store, retransmit, 
use or disclose its contents to anyone. Please note we reserve the right to 
monitor all e-mail communication through our internal and external networks. 
SKY and the SKY marks are trademarks of British Sky Broadcasting Group plc and 
Sky International AG and are used under licence. British Sky Broadcasting 
Limited (Registration No. 2906991), Sky-In-Home Service Limited (Registration 
No. 2067075) and Sky Subscribers Services Limited (Registration No. 2340150) 
are direct or indirect subsidiaries of British Sky Broadcasting Group plc 
(Registration No. 2247735). All of the companies mentioned in this!
  aragraph are incorporated in England and Wales and share the same registered 
office at Grant Way, Isleworth, Middlesex TW7 5QD.

Freeipa-users mailing list

Freeipa-users mailing list

Reply via email to