Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ACLIでNIC追加自動化くん(text / bash 編)
#!/bin/bash
HELP='Usage: CVM$ bash ./cli-vnic.create.sh VM_LIST_FILE AHV_NETWORK '
VM_LIST_FILE=$1
AHV_NETWORK=$2
CMD_OUTPUT_ONLY_FLG=$3
if [ "$#" -eq 0 ]; then
echo $HELP
exit 1
fi
if [ ! -f "$VM_LIST_FILE" ]; then
echo "file VM_LIST_FILE not found."; exit 1
fi
if [ -z "$AHV_NETWORK" ]; then
echo "file AHV_NETWORK not found."; exit 1
fi
cat $VM_LIST_FILE | grep -v -E "^$|#" | while read VM;
do
echo "---"
echo "Create vNIC: $VM `date`"
CMD="acli vm.nic_create $VM network=$AHV_NETWORK"
if [ "x$CMD_OUTPUT_ONLY_FLG" == "x" ]; then
$CMD
acli vm.nic_list $VM
else
echo $CMD
fi
done
@gowatana

This comment has been minimized.

Copy link
Owner Author

gowatana commented Dec 2, 2019

下記の投稿むけ。

acli で vNIC 追加自動化くん。(Test / Bash 編)
https://blog.ntnx.jp/entry/2019/12/02/000000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.