Setup crm

From PDP/Grid Wiki
(Redirected from Setup bdii)
Jump to navigationJump to search
#!/bin/bash

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

SERVICE=$1
IPADDR=$2
TYPE=$3

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 ${SERVICE} ocf:heartbeat:${SERVICE}
clone ${SERVICE}_clone ${SERVICE}
colocation ${SERVICE}-on-cluster INFINITY: ${SERVICE} 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 ${SERVICE} ocf:heartbeat:${SERVICE}
colocation ${SERVICE}-on-cluster INFINITY: ${SERVICE} 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