[Freeipa-users] Export user and host list to a csv or text file

Martin Kosek mkosek at redhat.com
Fri May 23 11:54:35 UTC 2014


On 05/23/2014 06:42 AM, Sanju A wrote:
> Dear All,
> 
> Is there any command to export the user and host list to a csv or text format

There is no such command out of the shelf, I would personally just write a
short Python script to export the hosts (or anything else) in a format I need.

Example for host:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#!/usr/bin/python2

from ipalib import api
api.bootstrap(context='exporter', debug=False)
api.finalize()
api.Backend.xmlclient.connect()

hosts = api.Command['host_find']()['result']

for host in hosts:
   print host['fqdn'][0]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This will print one host for each new line.

Martin




More information about the Freeipa-users mailing list