Unattended Install of a FreeIPA Server

As a developer, I install and uninstall the application I’m working on all the time. Back when I was working on FreeIPA full time, I had a couple of functions that I used to do an unattended install with some simple defaults. I recently cleaned them up a little. Since a few people have asked me for them, I’m posting them here.

I have another set of bash functions that manages my set of developer machines. One of the sets the $DEVSERVER variable in my environment.


#The Kerberos REALM generated by this is the domain segment of the
#fully qualified domain name (FQDN) converted to uppercase.    
#If you were running it on local host, you could use `hostname -d` 
#but that doesn't work for a remote system.
ipa-gen-realm(){
    ipahost=$DEVSERVER
    IPAREALM=$( echo $DEVSERVER  | cut -f2- -d. |tr '[:lower:]' '[:upper:]' )
    echo $IPAREALM
}

#The forwarder for DNS can be defined as the existing set of
#nameservers from /etc/resolv.conf.
ipa-gen-resolver(){
     ssh $DEVSERVER " cat /etc/resolv.conf" | awk '/nameserver/ {print $2}'
} 

ipa-gen-install-command(){
    echo  ipa-server-install  -U -r $(ipa-gen-realm) -p FreeIPA4All \
          -a FreeIPA4All --setup-dns --forwarder $( ipa-gen-resolver)
}

1 thought on “Unattended Install of a FreeIPA Server

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.