forked from Suse-KevinKlinger/RTDAD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloud_init.cfg
68 lines (65 loc) · 2.81 KB
/
cloud_init.cfg
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
#cloud-config
# vim: syntax=yaml
#
# ***********************
# ---- for more examples look at: ------
# ---> https://cloudinit.readthedocs.io/en/latest/topics/examples.html
# ******************************
#
# This is the configuration syntax that the write_files module
# will know how to understand. encoding can be given b64 or gzip or (gz+b64).
# The content will be decoded accordingly and then written to the path that is
# provided.
#
# Note: Content strings here are truncated for example purposes.
ssh_pwauth: True
chpasswd:
list: |
root:linux
expire: False
disable_root: false
resize_rootfs: false
ssh_authorized_keys:
- ${PUBLICKEY}
# cmds run after boot
runcmd:
- loadkeys de
- hostnamectl set-hostname "${HOSTNAME}"
- 'hostnamectl set-hostname --transient ""'
- 'systemctl stop network &&
sed -i -e "s/DHCLIENT_SET_DEFAULT_ROUTE=.*/DHCLIENT_SET_DEFAULT_ROUTE=\"no\"/g" /etc/sysconfig/network/dhcp &&
sed -i -e "s/NETCONFIG_DNS_STATIC_SEARCHLIST=.*/NETCONFIG_DNS_STATIC_SEARCHLIST=\"wdf.sap.corp\"/g" /etc/sysconfig/network/config &&
sed -i -e "s/NETCONFIG_DNS_STATIC_SERVERS=.*/NETCONFIG_DNS_STATIC_SERVERS=\"10.17.121.30 10.17.122.10\"/g" /etc/sysconfig/network/config &&
echo -e "BOOTPROTO=\"static\"\nIPADDR=\"${IPADDR}/22\"\nSTARTMODE=\"auto\"\n" > /etc/sysconfig/network/ifcfg-eth0 &&
echo -e "default 10.17.68.1 - -" > /etc/sysconfig/network/routes &&
systemctl start network &&
ip addr flush dev eth0 &&
echo -e "\nAdding IP to eth0:\n" >> /home/debug.txt &&
ip a a "${IPADDR}/22" dev eth0 &>> /home/debug.txt &&
echo -e "\nAdding default route via eth0:\n" >> /home/debug.txt &&
ip r a default via 10.17.68.1 &>> /home/debug.txt'
- dbus-uuidgen --ensure
- systemd-machine-id-setup
- systemctl restart systemd-journald
- SUSEConnect -p sle-module-basesystem/15.2/x86_64
- 'SUSEConnect --url "https://smtproxy.wdf.sap.corp"'
- SUSEConnect -p sle-module-containers/15.2/x86_64
- SUSEConnect -p sle-module-public-cloud/15.2/x86_64
- zypper in -y docker less open-iscsi
- systemctl enable iscsid --now
- 'zypper in -y salt-minion && echo "master: ${SALTMASTERADDR}" > /etc/salt/minion && systemctl enable salt-minion --now'
- sed -i -e "/^127.0.0.1.*/a ${REGIP} ${REGFQDN} ${REGHN}" /etc/hosts
- sysctl -w net.ipv4.ip_forward=1
- mkdir -p /root/.ssh
- echo 'type=83' | sfdisk /dev/vdb
- mkfs.xfs /dev/vdb1
- mkdir /var/lib/docker && sleep 2
- mount /dev/vdb1 /var/lib/docker && grep vdb1 /etc/mtab >> /etc/fstab
- systemctl enable --now docker
- 'if [ -e /dev/vdc ]; then
echo "type=83" | sfdisk /dev/vdc &&
mkfs.xfs /dev/vdc1 &&
mkdir /var/lib/longhorn && sleep 2 &&
mount /dev/vdc1 /var/lib/longhorn &&
grep vdc1 /etc/mtab >> /etc/fstab ; fi'
final_message: "The system is now ready, after $UPTIME seconds"