Created
December 12, 2017 12:22
-
-
Save hodrigohamalho/f05541f20d3ebb54d7031279d73f9515 to your computer and use it in GitHub Desktop.
lab01 - create pvs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NFS Server Host - CHANGE the GUID! | |
HOST=support1.54d2.internal | |
ROOT_NFS=/exports | |
NFS_CONFIG_FILE=/etc/exports.d/openshift-ansible.exports | |
create-pv () { | |
DIR=$1 | |
SIZE=$2 | |
ACCESS_MODE=$3 | |
RECLAIM_POLICY=$4 | |
cont=$(oc get pv | grep "^$DIR " | wc -l) | |
if [ $cont -eq 0 ];then | |
oc create -f -<< EOF | |
apiVersion: v1 | |
kind: PersistentVolume | |
metadata: | |
name: $DIR | |
spec: | |
capacity: | |
storage: ${SIZE}Gi | |
accessModes: | |
- $ACCESS_MODE | |
persistentVolumeReclaimPolicy: $RECLAIM_POLICY | |
nfs: | |
server: $HOST | |
path: $ROOT_NFS/$DIR | |
EOF | |
else | |
echo "PV already exists, skipping creation..." | |
fi | |
} | |
for i in {1..25};do | |
create-pv pv$i 5 ReadWriteOnce Recycle | |
done | |
for i in {26..50};do | |
create-pv pv$i 10 ReadWriteMany Retain | |
done |
it's weird...
I executed this on my lab and in the colleague lab and it works that way, Do you tried in a RHEL, right ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
create-pv
: not a valid identifierPlease, change the function name from
create-pv
tocreatepv
. 👍