disable nfs and copy ssh public keys to container

This commit is contained in:
Christian Goll
2022-11-30 15:29:50 +01:00
parent 9ec86a18b4
commit 275a89a78b
4 changed files with 20 additions and 10 deletions

View File

@@ -51,6 +51,7 @@ RUN zypper -n install \
dhcp-server \
iproute2 \
vim \
yq \
tftp \
systemd \
&& \
@@ -61,11 +62,12 @@ RUN zypper -n install \
sed -i 's/^DHCPD_INTERFACE=""/DHCPD_INTERFACE="ANY"/' $DHCPDCONF && \
sed -i 's/^DHCPD_RUN_CHROOTED="yes"/DHCPD_RUN_CHROOTED="no"/' $DHCPDCONF && \
WW4CONF=/etc/warewulf/warewulf.conf; test -e $WW4CONF && \
sed -i 's/^ipaddr:.*/ipaddr: EMPTY/' $WW4CONF && \
sed -i 's/^netmask:.*/netmask: EMPTY/' $WW4CONF && \
sed -i 's/^network:.*/network: EMPTY/' $WW4CONF && \
sed -i 's/^ range start:.*/ range start: EMPTY/' $WW4CONF && \
sed -i 's/^ range end:.*/ range end: EMPTY/' $WW4CONF && \
yq e '.ipaddr |= "EMPTY"' -i $WW4CONF && \
yq e '.netmask |= "EMPTY"' -i $WW4CONF && \
yq e '.network |= "EMPTY"' -i $WW4CONF && \
yq e '.dhcp.["range start"] |= "EMPTY"' -i $WW4CONF && \
yq e '.dhcp.["range end"] |= "EMPTY"' -i $WW4CONF && \
yq e '.nfs.enabled |= false' -i $WW4CONF && \
mkdir -p /container && \
cp -vr container-scripts/label-* \
container-scripts/wwctl \
@@ -74,7 +76,7 @@ RUN zypper -n install \
container-scripts/config-warewulf \
/container &&\
mkdir -p /usr/share/bash_completion/completions/ &&\
cp /etc/warewulf/bash_completion.d/warewulf /usr/share/bash_completion/completions/wwctl &&\
cp /etc/warewulf/bash_completion.d/warewulf /usr/share/bash_completion/completions/warewulf &&\
mv -v container-scripts/ww4-config.service /etc/systemd/system/ &&\
mv -v container-scripts/warewulfd.service /etc/systemd/system/ &&\
systemctl enable ww4-config &&\

View File

@@ -69,6 +69,7 @@ fi
# configure the services of the host by building the host overlay
echo "-- Running wwctl --"
wwctl overlay build
# enable tftp if systemd is running
test -e /run/systemd/system && wwctl configure tftp
test -e /run/systemd/system && wwctl configure ssh
wwctl overlay build

View File

@@ -12,7 +12,8 @@ OVERLAYDIR=/var/lib/warewulf/overlays
CHROOTDIR=/var/lib/warewulf/chroots
CONTAINERDIR=/var/lib/warewulf/container
WAREWULFCONF=/etc/warewulf
BASHCOMPLETION=/usr/share/bash_completion/completions/wwctl
BASHCOMPLETION=/usr/share/bash_completion/completions/w*
AUTHKEYDIR=/root/.ssh
echo "LABEL INSTALL"
# ensure all scripts will be present on the host
@@ -67,10 +68,15 @@ sync_dir $CHROOTDIR
sync_dir $WAREWULFCONF
# bash completion
if [ ! -e /host/etc/bash_completion.d/wwctl ] ; then
if [ ! -e /host/etc/bash_completion.d/warewulf ] ; then
mkdir -p /host/etc/bash_completion.d
cp $BASHCOMPLETION /host/etc/bash_completion.d/
fi
# containerdir
mkdir -p /host/$CONTAINERDIR
# authorized keys
mkdir -p /root/.ssh/
echo "Copy authorized keys to container"
test -e /host/${AUTHKEYDIR}/*pub && cp -v /host/${AUTHKEYDIR}/*pub ${AUTHKEYDIR} || echo "no public keys found"

View File

@@ -1,6 +1,7 @@
#!/bin/bash
OVERLAYDIR=/var/lib/warewulf/overlays
CHROOTDIR=/var/lib/warewulf/chroots
OCIDIR=/var/lib/warewulf/oci
CONTAINERDIR=/var/lib/warewulf/container
WAREWULFCONF=/etc/warewulf
BASEDIR=/var/lib/warewulf
@@ -28,6 +29,6 @@ while true ; do
done
echo "PURGING"
/container/label-uninstall
rm -rv /host/$WAREWULFCONF /host/$OVERLAYDIR /host/$CHROOTDIR /host/$CONTAINERDIR
rm -rv /host/$WAREWULFCONF /host/$OVERLAYDIR /host/$CHROOTDIR /host/$CONTAINERDIR /host/$OCIDIR
rmdir /host/$BASEDIR