Skip to content

Commit

Permalink
Merge pull request redhat-openstack#34 from GregSutcliffe/master
Browse files Browse the repository at this point in the history
Network related changes
  • Loading branch information
jsomara committed Jun 3, 2013
2 parents 1a170ce + 5dfbbe4 commit 76429ee
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 19 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ Prerequisites:
RHEL 6.4
* This *should* work on other operating systems, but has only been tested on RHEL6.4

Network layout
* Each machine has a public and a private network interface (i.e eth0 & eth1)
* Network gateway is at $(NETWORK).1

At least 3 machines
* 1 Foreman Host
* 1 OpenStack Controller Node
* 1+ OpenStack Compute Nodes
* 1 Foreman Host (private address $(NETWORK).2 )
* 1 OpenStack Controller Node (private address $(NETWORK.3 )
* 1+ OpenStack Compute Nodes

Ipaddress defaults can be changed in the class parameters

Preconfiguration - these machines should be:
* Running RHEL 6.4
Expand Down
21 changes: 12 additions & 9 deletions bin/foreman_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ if [ ! -f /etc/redhat-release ] || \
fi

if [ "$FOREMAN_PROVISIONING" = "true" ]; then
NUM_INT=$(scl enable ruby193 "facter -p"|grep ipaddress_|grep -v _lo|wc -l)
if [[ $NUM_INT -lt 2 ]] ; then
echo "This installer needs 2 configured interfaces - only $NUM_INT detected"
exit 1
fi
PRIMARY_INT=$(route|grep default|awk ' { print ( $(NF) ) }')
NUM_INT=$(scl enable ruby193 "facter -p"|grep ipaddress_|grep -v _lo|wc -l)
if [[ $NUM_INT -lt 2 ]] ; then
echo "This installer needs 2 configured interfaces - only $NUM_INT detected"
exit 1
fi
PRIMARY_INT=$(route|grep default|awk ' { print ( $(NF) ) }')
PRIMARY_PREFIX=$(scl enable ruby193 "facter network_${PRIMARY_INT}" | cut -d. -f1-3)
SECONDARY_INT=$(scl enable ruby193 "facter -p"|grep ipaddress_|grep -Ev "_lo|$PRIMARY_INT"|awk -F"[_ ]" '{print $2;exit 0}')
SECONDARY_PREFIX=$(scl enable ruby193 "facter network_${SECONDARY_INT}" | cut -d. -f1-3) # -> 10.0.0 -> '0.0.10.in-addr.arpa',
SECONDARY_PREFIX=$(scl enable ruby193 "facter network_${SECONDARY_INT}" | cut -d. -f1-3)
SECONDARY_REVERSE=$(echo "$SECONDARY_PREFIX" | ( IFS='.' read a b c ; echo "$c.$b.$a.in-addr.arpa" ))
FORWARDER=$(augtool get /files/etc/resolv.conf/nameserver[1] | awk '{printf $NF}')
fi
Expand Down Expand Up @@ -108,7 +109,7 @@ EOM
if [ "$FOREMAN_PROVISIONING" = "true" ]; then
cat >> installer.pp << EOM
dhcp => true,
dhcp_gateway => '${SECONDARY_PREFIX}.1',
dhcp_gateway => false,
dhcp_range => '${SECONDARY_PREFIX}.50 ${SECONDARY_PREFIX}.200',
dhcp_interface => '${SECONDARY_INT}',
Expand All @@ -126,7 +127,7 @@ cat >> installer.pp << EOM
tftp => false,
}
EOM

fi

scl enable ruby193 "puppet apply --verbose installer.pp --modulepath=. "
Expand Down Expand Up @@ -156,6 +157,8 @@ done

sed -i "s/PRIMARY/$PRIMARY_INT/" ../puppet/modules/trystack/manifests/params.pp
sed -i "s/SECONDARY/$SECONDARY_INT/" ../puppet/modules/trystack/manifests/params.pp
sed -i "s/PUB_IP/${PRIMARY_PREFIX}.3/" ../puppet/modules/trystack/manifests/params.pp
sed -i "s/PRIV_IP/${SECONDARY_PREFIX}.3/" ../puppet/modules/trystack/manifests/params.pp

# install puppet modules
mkdir -p $SCL_RUBY_HOME/etc/puppet/environments/production/modules
Expand Down
2 changes: 1 addition & 1 deletion installer_puppet/dhcp/manifests/pool.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
$network,
$mask,
$range = false,
$gateway
$gateway = false
) {

include dhcp::params
Expand Down
2 changes: 2 additions & 0 deletions installer_puppet/dhcp/templates/dhcpd.pool.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ subnet <%= network %> netmask <%= mask %> {
<% end -%>

option subnet-mask <%= mask %>;
<% if gateway -%>
option routers <%= gateway %>;
<% end -%>
}

2 changes: 1 addition & 1 deletion installer_puppet/puppet/manifests/cron.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}

cron { 'puppet':
command => "/usr/bin/env puppet agent --config ${puppet::dir}/puppet.conf --onetime --no-daemonize",
command => "/usr/bin/env scl enable ruby193 \"puppet agent --config /opt/rh/ruby193/root/etc/puppet/puppet.conf --onetime --no-daemonize\""
user => root,
minute => ip_to_cron($puppet::cron_interval, $puppet::cron_range),
}
Expand Down
10 changes: 5 additions & 5 deletions puppet/trystack/manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
$nova_db_password = 'CHANGEME'
$nova_user_password = 'CHANGEME'

# Networking
# Networking - we're assuming /24 ranges, but the user can always override
$public_interface = 'PRIMARY'
$private_interface = 'SECONDARY'
$fixed_network_range = inline_template("<%= scope.lookupvar('::network_${private_interface}') + '/' + scope.lookupvar('::netmask_${private_interface}') %>")
$floating_network_range = inline_template("<%= scope.lookupvar('::network_${public_interface}') + '/' + scope.lookupvar('::netmask_${public_interface}') %>")
$pacemaker_priv_floating_ip = inline_template("<%= scope.lookupvar('::ipaddress_${private_interface}') %>")
$pacemaker_pub_floating_ip = inline_template("<%= scope.lookupvar('::ipaddress_${public_interface}') %>")
$fixed_network_range = inline_template("<%= scope.lookupvar('::network_${private_interface}') + '/24' %>")
$floating_network_range = inline_template("<%= scope.lookupvar('::network_${public_interface}') + '/24' %>")
$pacemaker_priv_floating_ip = 'PRIV_IP'
$pacemaker_pub_floating_ip = 'PUB_IP'

# Logs
$admin_email = "admin@${::domain}"
Expand Down

0 comments on commit 76429ee

Please sign in to comment.