This repository has been archived by the owner on Aug 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
4-gen-cloudinit.sh.old
executable file
·88 lines (76 loc) · 1.75 KB
/
4-gen-cloudinit.sh.old
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Here we create the meta-data and user-data files for cloud-init,
# generate the iso, and copy it to $VMPATH
#
source 1-config.sh
if [ "$RHPASS" == "" ]
then
echo "You need to set and export RHPASS env variable."
exit 1;
fi
# grab hypervisor root user's ssh key to insert
PUBRSA=`cat ~/.ssh/id_rsa.pub`
echo $PUBRSA
# Create meta-data for cloud-init
cat > meta-data << _EOF_
instance-id: $DOMNAME
local-hostname: ${DOMNAME}.example${OCTET}.com
_EOF_
# Create user-data for cloud-init
# sudo: ["ALL=(ALL) ALL:ALL"]
cat > user-data << _EOF_
#cloud-config
users:
- default
- name: cloud-user
chpasswd: {expire: False}
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
groups: users,wheel,adm,systemd-journal
ssh_pwauth: True
ssh_authorized_keys:
- $PUBRSA
- name: root
ssh_pwauth: True
ssh_authorized_keys:
- $PUBRSA
chpasswd:
list: |
root:redhat
cloud-user:redhat
expire: False
write_files:
- path: /etc/systemd/system/cockpitws.service
permissions: '0644'
owner: root:root
encoding: b64
content: $PUBRSA
rh_subscription:
username: $RHNUSER
password: $RHNPASS
service-level: self-support
add-pool 8a85f9833e1404a9013e3cddf95a0599
add-pool 8a85f981501430fe015019593a930646
packages:
- git
- screen
- vim-enhanced
- redhat-support-tool
- pcp
- sos
- chrony
- kexec-tools
- abrt-addon-kerneloops
- abrt-addon-ccpp
- abrt-cli
- spice-vdagent
- openssh-clients
- wget
runcmd:
- systemctl daemon-reload
- systemctl enable cockpitws.service
_EOF_
# rh_subscription
# auto-attach: True
# Create the image and move into place
genisoimage -output ${DOMNAME}-cloudinit.iso -volid cidata -joliet -rock user-data meta-data
sudo mv ${DOMNAME}-cloudinit.iso $ISOPATH/
ls -lh $ISOPATH/