-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-cidata.sh
executable file
·50 lines (39 loc) · 969 Bytes
/
make-cidata.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# Take one argument from the commandline: VM name
if ! [ $# -eq 1 ]; then
echo "Usage: $0 <hostname>"
echo "ie: make-cidata hp00"
exit 1
fi
TARGET_HOSTNAME=$1
cat > meta-data << _EOF_
instance-id: $TARGET_HOSTNAME
local-hostname: $TARGET_HOSTNAME
_EOF_
genisoimage -output $TARGET_HOSTNAME-cidata.iso -volid CIDATA -joliet -rock meta-data
# for after
# SSH_PUB_KEY=`cat ~/.ssh/id_rsa.pub`
# SSH_PRIVVM_KEY=`cat ~/.ssh/vm | sed 's/^/ /'`
# SSH_PUBVM_KEY=`cat ~/.ssh/vm.pub`
# cat > user-data << _EOF_
# #cloud-config
# ssh_pwauth: True
# ssh_authorized_keys:
# - $SSH_PUB_KEY
# ssh_keys:
# rsa_private: |
# $SSH_PRIVVM_KEY
# rsa_public: $SSH_PUBVM_KEY
# users:
# - name: $TARGET_USER
# gecos: $TARGET_USER
# shell: /bin/bash
# lock-passwd: false
# sudo: ALL=(ALL) NOPASSWD:ALL
# ssh_authorized_keys:
# - $SSH_PUB_KEY
# chpasswd:
# list: |
# $TARGET_USER:password
# expire: False
# _EOF_