mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-22 22:21:10 +02:00
oem/oracle: Set SSH keys when launching instance
This commit is contained in:
parent
51c5345c0d
commit
95b2c96ce2
@ -13,10 +13,15 @@ name=
|
|||||||
shape="VM.Standard1.1"
|
shape="VM.Standard1.1"
|
||||||
ipxe=0
|
ipxe=0
|
||||||
ignition=
|
ignition=
|
||||||
|
keyfile="$HOME/.ssh/id_rsa.pub"
|
||||||
baseurl="http://alpha.release.core-os.net/amd64-usr/current"
|
baseurl="http://alpha.release.core-os.net/amd64-usr/current"
|
||||||
bucket_base="users.developer.core-os.net/$USER/bmcs"
|
bucket_base="users.developer.core-os.net/$USER/bmcs"
|
||||||
kargs=
|
kargs=
|
||||||
|
|
||||||
|
if [[ ! -f "$keyfile" ]]; then
|
||||||
|
keyfile=""
|
||||||
|
fi
|
||||||
|
|
||||||
# Parse args
|
# Parse args
|
||||||
usage="Usage: $0 [args] -n name
|
usage="Usage: $0 [args] -n name
|
||||||
Options:
|
Options:
|
||||||
@ -26,6 +31,7 @@ Options:
|
|||||||
-s SHAPE Instance shape (default: ${shape})
|
-s SHAPE Instance shape (default: ${shape})
|
||||||
-S SUBNET-ID Subnet ID to use (default: ${subnet_id})
|
-S SUBNET-ID Subnet ID to use (default: ${subnet_id})
|
||||||
-i IGNITION Path to Ignition config
|
-i IGNITION Path to Ignition config
|
||||||
|
-A SSH-KEYS Path to SSH keys (default: ${keyfile})
|
||||||
-p Boot with iPXE
|
-p Boot with iPXE
|
||||||
-I IMAGE-ID Image ID to use; only relevant for non-iPXE (default: ${image_id})
|
-I IMAGE-ID Image ID to use; only relevant for non-iPXE (default: ${image_id})
|
||||||
-b BASEURL URL to the image mirror; only relevant for iPXE (default: ${baseurl})
|
-b BASEURL URL to the image mirror; only relevant for iPXE (default: ${baseurl})
|
||||||
@ -33,7 +39,7 @@ Options:
|
|||||||
-k ARGS Additional kernel command line arguments for iPXE script
|
-k ARGS Additional kernel command line arguments for iPXE script
|
||||||
-h This ;-)
|
-h This ;-)
|
||||||
"
|
"
|
||||||
while getopts "c:a:n:s:S:i:pI:b:B:k:h" OPTION
|
while getopts "c:a:n:s:S:i:A:pI:b:B:k:h" OPTION
|
||||||
do
|
do
|
||||||
case "${OPTION}" in
|
case "${OPTION}" in
|
||||||
c) compartment="${OPTARG}" ;;
|
c) compartment="${OPTARG}" ;;
|
||||||
@ -42,6 +48,7 @@ do
|
|||||||
s) shape="${OPTARG}" ;;
|
s) shape="${OPTARG}" ;;
|
||||||
S) subnet_id="${OPTARG}" ;;
|
S) subnet_id="${OPTARG}" ;;
|
||||||
i) ignition="${OPTARG}" ;;
|
i) ignition="${OPTARG}" ;;
|
||||||
|
A) keyfile="${OPTARG}" ;;
|
||||||
p) ipxe=1 ;;
|
p) ipxe=1 ;;
|
||||||
I) image_id="${OPTARG}" ;;
|
I) image_id="${OPTARG}" ;;
|
||||||
b) baseurl="${OPTARG}" ;;
|
b) baseurl="${OPTARG}" ;;
|
||||||
@ -97,6 +104,9 @@ fi
|
|||||||
if [[ -n "${ignition}" ]]; then
|
if [[ -n "${ignition}" ]]; then
|
||||||
launch_args+=("--user-data-file" "${ignition}")
|
launch_args+=("--user-data-file" "${ignition}")
|
||||||
fi
|
fi
|
||||||
|
if [[ -n "${keyfile}" ]]; then
|
||||||
|
launch_args+=("--ssh-authorized-keys-file" "${keyfile}")
|
||||||
|
fi
|
||||||
bmcs compute instance launch \
|
bmcs compute instance launch \
|
||||||
--availability-domain "${availability_domain}" \
|
--availability-domain "${availability_domain}" \
|
||||||
--compartment-id "${compartment}" \
|
--compartment-id "${compartment}" \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user