Skip to content
This repository has been archived by the owner on Feb 25, 2023. It is now read-only.

Commit

Permalink
Update the vagrant template to allow adding interface
Browse files Browse the repository at this point in the history
Including motd for network interface display IP
Provide suse vm guest setting to allow faster startup time.

Signed-off-by: Alex Lau (AvengerMoJo) <alau@suse.com>
  • Loading branch information
AvengerMoJo committed Apr 22, 2021
1 parent cb8898d commit dacc1e5
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 12 deletions.
1 change: 1 addition & 0 deletions images/microOS/config.sh
Expand Up @@ -40,6 +40,7 @@ suseSetupProduct
#--------------------------------------
suseInsertService sshd
suseInsertService aquarium
suseInsertService update_motd

#======================================
# Specify default systemd target
Expand Down
3 changes: 2 additions & 1 deletion images/microOS/config.xml
Expand Up @@ -94,7 +94,7 @@
firmware="uefi"
initrd_system="dracut"
installiso="true"
kernelcmdline="quiet systemd.show_status=yes console=ttyS0,115200 console=tty0 net.ifnames=0 \$ignition_firstboot ignition.platform.id=qemu"
kernelcmdline="quiet systemd.show_status=yes console=ttyS0,115200 console=tty0"
devicepersistency="by-uuid"
>
<oemconfig>
Expand Down Expand Up @@ -178,6 +178,7 @@
<package name="grep"/>
<package name="gzip"/>
<package name="gawk"/>
<package name="issue-generator"/>

<!-- Vagrant sudo-->
<package name="sudo"/>
Expand Down
9 changes: 0 additions & 9 deletions images/microOS/root/etc/motd

This file was deleted.

20 changes: 20 additions & 0 deletions images/microOS/root/etc/motd.template
@@ -0,0 +1,20 @@
_ _
/ \ __ _ _ _ __ _ _ __ (_) _ _ _ __ ___
/ _ \ / _` || | | | / _` || '__|| || | | || '_ ` _ \
/ ___ \| (_| || |_| || (_| || | | || |_| || | | | | |
/_/ \_\\__, | \__,_| \__,_||_| |_| \__,_||_| |_| |_|
|_|
This is a ceph Appliance System [Aquarium] OS base on openSUSE.
The webservice is running on

<<network interfaces>>

port 1337


To upgrade your system call:

zypper refresh
zypper dup

Have a lot of fun...
15 changes: 15 additions & 0 deletions images/microOS/root/usr/bin/update_motd.sh
@@ -0,0 +1,15 @@
#!/bin/sh



INTERFACES=`ip addr| awk '/.*: .*: / {print $2}'`

for i in $INTERFACES; do

LINE="$LINE$i\\t`ip addr show $i | grep "inet " | awk '{gsub(/\//,"\\\/")} 1 {print $2}'`\n"

done

sed 's/<<network interfaces>>/'"$LINE"'/' /etc/motd.template > /etc/motd

exit 0
2 changes: 2 additions & 0 deletions images/microOS/root/usr/lib/issue.d/10-0S
@@ -0,0 +1,2 @@
Welcome to Aquarium - Kernel \r (\l).

5 changes: 5 additions & 0 deletions images/microOS/root/usr/lib/systemd/network/80-mac-net.link
@@ -0,0 +1,5 @@
[Link]
NamePolicy=mac
MACAddressPolicy=persistent
[Match]
OriginalName=*
10 changes: 10 additions & 0 deletions images/microOS/root/usr/lib/systemd/system/update_motd.service
@@ -0,0 +1,10 @@
[Unit]
Description=Update motd with current network configuration
After=network.target

[Service]
User=root
ExecStart=/usr/bin/update_motd.sh

[Install]
WantedBy=multi-user.target
40 changes: 40 additions & 0 deletions tests/vagrant/templates/Vagrantfile.tmpl
@@ -0,0 +1,40 @@
# -*- mode: ruby -*-
# vim: set ft=ruby

Vagrant.configure("2") do |config|
config.vm.box = "{BOXNAME}"
# The nfs server on Leap has udp enabled by default, but not on Tumbleweed
# Disable udp to make it working for any host system by default.
config.vm.synced_folder "{ROOTDIR}", "/srv/aquarium", type: "nfs", nfs_udp: false
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.network "forwarded_port", guest: 1337, host: 1337, host_ip: "*"
config.vm.network "private_network", type: "dhcp", auto_config: false
config.vm.guest = "suse"

config.vm.define :"node01", primary: true do |node|
node.vm.hostname = "node01"

node.vm.provider "libvirt" do |lv|
lv.memory = 4096
lv.cpus = 1
lv.storage :file, size: "8G", type: "qcow2", serial: "01123456"
lv.storage :file, size: "8G", type: "qcow2", serial: "01789101"
lv.storage :file, size: "8G", type: "qcow2", serial: "01112131"
lv.storage :file, size: "8G", type: "qcow2", serial: "01415161"
end
end

config.vm.define :"node02" do |node|
node.vm.hostname = "node02"
node.vm.network "forwarded_port", guest: 1337, host: 1338, host_ip: "*"

node.vm.provider "libvirt" do |lv|
lv.memory = 4096
lv.cpus = 1
lv.storage :file, size: "8G", type: "qcow2", serial: "02123456"
lv.storage :file, size: "8G", type: "qcow2", serial: "02789101"
lv.storage :file, size: "8G", type: "qcow2", serial: "02112131"
lv.storage :file, size: "8G", type: "qcow2", serial: "02415161"
end
end
end
4 changes: 2 additions & 2 deletions tools/build-image.sh
Expand Up @@ -146,14 +146,14 @@ make dist
tmpdir=$(mktemp -d)
pushd ${tmpdir}
tar --strip-components=1 -xzf ${rootdir}/aquarium*.tar.gz
cp -ar ${imgdir}/microOS/root/* ./
sudo cp -r ${imgdir}/microOS/root/* ./
tar -czf ${build}/aquarium.tar.gz .
popd
rm -rf ${tmpdir}

tmpdir=$(mktemp -d)
pushd ${tmpdir}
cp -ar ${imgdir}/microOS/aquarium_root/* ./
sudo cp -r ${imgdir}/microOS/aquarium_root/* ./
tar -czf ${build}/aquarium_user.tar.gz .
popd
rm -rf ${tmpdir}
Expand Down

0 comments on commit dacc1e5

Please sign in to comment.