3 # Used environment variables:
7 # - DirectoryManagerPassword
11 # - ProvisioningCIDR: If set, it adds the given CIDR to the provisioning
12 # interface (which is hardcoded to eth1)
13 # - UsingNovajoin: If unset, we pre-provision the service principals
14 # needed for the overcloud deploy. If set, we skip this,
15 # since novajoin will do it.
19 if [ -f "~/freeipa-setup.env" ]; then
20 source ~/freeipa-setup.env
21 elif [ -f "/tmp/freeipa-setup.env" ]; then
22 source /tmp/freeipa-setup.env
25 if [ -n "$ProvisioningCIDR" ]; then
26 # Add address to provisioning network interface
27 ip link set dev eth1 up
28 ip addr add $ProvisioningCIDR dev eth1
32 echo "nameserver 8.8.8.8" >> /etc/resolv.conf
33 echo "nameserver 8.8.4.4" >> /etc/resolv.conf
35 yum -q -y remove openstack-dashboard
37 # Install the needed packages
38 yum -q install -y ipa-server ipa-server-dns epel-release rng-tools mod_nss git
39 yum -q install -y haveged
42 hostnamectl set-hostname --static $Hostname
44 echo $FreeIPAIP `hostname` | tee -a /etc/hosts
47 cat << EOF > freeipa-iptables-rules.txt
48 # Firewall configuration written by system-config-firewall
49 # Manual customization of this file is not recommended.
54 -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
55 -A INPUT -p icmp -j ACCEPT
56 -A INPUT -i lo -j ACCEPT
57 -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
58 #TCP ports for FreeIPA
59 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
60 -A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
61 -A INPUT -m state --state NEW -m tcp -p tcp --dport 389 -j ACCEPT
62 -A INPUT -m state --state NEW -m tcp -p tcp --dport 636 -j ACCEPT
63 -A INPUT -m state --state NEW -m tcp -p tcp --dport 88 -j ACCEPT
64 -A INPUT -m state --state NEW -m tcp -p tcp --dport 464 -j ACCEPT
65 -A INPUT -m state --state NEW -m tcp -p tcp --dport 53 -j ACCEPT
66 #UDP ports for FreeIPA
67 -A INPUT -m state --state NEW -m udp -p udp --dport 88 -j ACCEPT
68 -A INPUT -m state --state NEW -m udp -p udp --dport 464 -j ACCEPT
69 -A INPUT -m state --state NEW -m udp -p udp --dport 123 -j ACCEPT
70 -A INPUT -m state --state NEW -m udp -p udp --dport 53 -j ACCEPT
71 -A INPUT -j REJECT --reject-with icmp-host-prohibited
72 -A FORWARD -j REJECT --reject-with icmp-host-prohibited
76 iptables-restore < freeipa-iptables-rules.txt
78 # Entropy generation; otherwise, ipa-server-install will lag.
80 systemctl start haveged
82 # Remove conflicting httpd configuration
83 rm -f /etc/httpd/conf.d/ssl.conf
86 ipa-server-install -U -r `hostname -d|tr "[a-z]" "[A-Z]"` \
87 -p $DirectoryManagerPassword -a $AdminPassword \
88 --hostname `hostname -f`
91 echo $AdminPassword | kinit admin
96 if [ "$?" = '1' ]; then
100 if [ -z "$UsingNovajoin" ]; then
101 # Create undercloud host
102 ipa host-add $UndercloudFQDN --password=$HostsSecret --force
104 # Create overcloud nodes and services
105 git clone https://github.com/JAORMX/freeipa-tripleo-incubator.git
106 cd freeipa-tripleo-incubator
107 python create_ipa_tripleo_host_setup.py -w $HostsSecret -d $(hostname -d) \
108 --controller-count 1 --compute-count 1