summaryrefslogtreecommitdiff
path: root/centos7/02_master_network.sh
blob: b988af1c875f84013511df151132d27762393535 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env bash

# This script installs OpenHPC on a bare CentOS machine.
# The base of this script is from the docs-ohpc package at
# /opt/ohpc/pub/doc/recipes/centos7/aarch64/warewulf/slurm/recipe.sh
# For more information, see the OpenHPC installation guide, Apendix A.
# Requires input.local and a set environment correctly beforehand.

######################################################
# Stage 02: Master network setup

set -ex

. ./input.local

if [[ ${node_is_master} -eq 0 ]]; then
  echo "This script only runs on the master node"
  exit 0
fi

# ------------------------------------------------------------
# Add InfiniBand support services on master node (Section 4.5)
# ------------------------------------------------------------

if [[ ${enable_ipoib} -eq 1 ]];then
     # Enable ib0
     cp /opt/ohpc/pub/examples/network/centos/ifcfg-ib0 /etc/sysconfig/network-scripts
     perl -pi -e "s/master_ipoib/${sms_ipoib}/" /etc/sysconfig/network-scripts/ifcfg-ib0
     perl -pi -e "s/ipoib_netmask/${ipoib_netmask}/" /etc/sysconfig/network-scripts/ifcfg-ib0
     ifup ib0
fi

# -----------------------------------------------------------
# Complete basic Warewulf setup for master node (Section 4.6)
# -----------------------------------------------------------

# Persist DHCP config for external interface
tee /etc/sysconfig/network-scripts/ifcfg-${eth_provision} << EOF
DEVICE="${eth_provision}"
BOOTPROTO="dhcp"
ONBOOT="yes"
TYPE="Ethernet"
USERCTL="no"
PEERDNS="yes"
PERSISTENT_DHCLIENT="1"
EOF

# If the master is a gateway, we need to setup the internal eth, TFTP
if [[ ${master_is_gateway} -eq 1 ]]; then
  # Persist static configuration from sms parameters
  tee /etc/sysconfig/network-scripts/ifcfg-${sms_eth_internal} << EOF
DEVICE="${sms_eth_internal}"
BOOTPROTO="static"
ONBOOT="yes"
TYPE="Ethernet"
NETMASK="${internal_netmask}"
IPADDR="${sms_ip}"
USERCTL="no"
EOF
  ifdown ${sms_eth_internal}
  ifup ${sms_eth_internal}
fi

# Basic services for warewulf provisioning
perl -pi -e "s/device = eth1/device = ${sms_eth_internal}/" /etc/warewulf/provision.conf
perl -pi -e "s/^\s+disable\s+= yes/ disable = no/" /etc/xinetd.d/tftp

systemctl restart xinetd
systemctl restart httpd