bstinson / centos / t_functional

Forked from centos/t_functional 4 years ago
Clone

Blame tests/p_ipa-server/2-configure_freeipa.sh

James Hogarth a5d690
#!/bin/bash
James Hogarth a5d690
# Author: James Hogarth <james.hogarth@gmail.com>
James Hogarth a5d690
#
James Hogarth abe41f
if (t_GetPkgRel basesystem | grep -qE 'el(6|7)')
c3b6d5
  then
James Hogarth a5d690
c3b6d5
  t_Log "Running $0 - setting hostname of system"
c3b6d5
  eth_int=$(ip addr|grep -B 1 "link/ether"|head -n 1|awk '{print $2}'|tr -d ':')
c3b6d5
  eth_ip=$(ip -4 addr show dev $eth_int | awk '$0 ~ /scope global/ {print $2}' | cut -d'/' -f 1)
c3b6d5
  if [ "$centos_ver" = "7" ] ; then
c3b6d5
    hostnamectl set-hostname c6test.c6ipa.local 
c3b6d5
  else
c3b6d5
    hostname c6test.c6ipa.local
c3b6d5
  fi
James Hogarth af79cd
c3b6d5
  echo $eth_ip $(hostname) >> /etc/hosts
c3b6d5
  hostname | grep "c6test.c6ipa.local" &> /dev/null
c3b6d5
  t_CheckExitStatus $?
James Hogarth af79cd
James Hogarth a5d690
c3b6d5
  t_Log "Running $0 - Configuring IPA server - this can take some time"
James Hogarth a5d690
c3b6d5
  ipa-server-install -U --hostname=c6test.c6ipa.local --ip-address=$eth_ip -r C6IPA.LOCAL -n c6ipa.local -p p455w0rd -a p455w0rd --ssh-trust-dns --setup-dns --forwarder=$(awk '$0 ~ /nameserver/ {print $2}' /etc/resolv.conf | head -n 1) 
James Hogarth b59b84
c3b6d5
  t_CheckExitStatus $?
James Hogarth 0a8a3f
c3b6d5
  t_Log "Running $0 - Enabling mkhomedir"
c3b6d5
  authconfig --enablemkhomedir --enablesssd --update
c3b6d5
  t_CheckExitStatus $?
c3b6d5
c3b6d5
  if /sbin/service sssd status | grep 'is stopped' &> /dev/null
c3b6d5
    then
c3b6d5
    /sbin/service sssd start &> /dev/null
c3b6d5
  fi
James Hogarth a5d690
James Hogarth acc301
else
c3b6d5
  echo "Skipped on CentOS 5"
James Hogarth acc301
fi
James Hogarth acc301