Setup crm

From PDP/Grid Wiki
Revision as of 14:28, 31 May 2011 by Gertp (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
#!/bin/bash

#
#       run on ONE node in a cluster-to-be
#
if [ $# -ne 2 -o "$2" != activeactive -o "$2" != activepassive ]; then
        echo "usage: $0 ipaddr {activeactive|activepassive}"
        exit 1
fi

IPADDR=$1
#IPADDR=194.171.97.37
TYPE=$2
#TYPE='activeactive'
#TYPE='activepassive'

if [ $TYPE = 'activeactive' ]; then

    crm configure <<UFO

property stonith-enabled=false
commit

primitive ClusterIP ocf:heartbeat:IPaddr2 params ip=$IPADDR cidr_netmask=32 clusterip_hash="sourceip" op monitor interval=10s
clone ClusterIP_clone ClusterIP meta globally-unique=true clone-max=2 clone-node-max=2
commit

property no-quorum-policy=ignore
rsc_defaults resource-stickiness=100
commit

primitive bdii ocf:heartbeat:bdii
clone bdii_clone bdii
colocation bdii-on-cluster INFINITY: bdii ClusterIP
fence-reboot stonith::suicide
clone fencing fence-reboot
property stonith-enabled="true"
commit

UFO

elif [ $TYPE = 'activepassive' ]; then

    crm configure <<UFO

property stonith-enabled=false
commit

primitive ClusterIP ocf:heartbeat:IPaddr2 params ip=$IPADDR cidr_netmask=32 op monitor interval=10s
property no-quorum-policy=ignore
rsc_defaults resource-stickiness=100
commit

primitive bdii ocf:heartbeat:bdii
colocation bdii-on-cluster INFINITY: bdii ClusterIP
fence-reboot stonith::suicide
clone fencing fence-reboot
property stonith-enabled="true"
commit

UFO

else
    echo 'improper TYPE specified'
    exit 1
fi


exit 0