Progress on testing provisioning on multiple distros. So far Debian and Ubuntu are working. Others need packages added.

This commit is contained in:
2025-10-10 16:07:17 -07:00
parent bde78a1489
commit 9381d61d99
9 changed files with 258 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
# Create a VM for testing Ansible provisioning.
FROM archlinux:base
RUN pacman -Syu --noconfirm && pacman -Sy --noconfirm git bash curl sudo
COPY bin/main.sh /root/main.sh
RUN chmod +x /root/main.sh
WORKDIR /root/
USER root
CMD ./main.sh

View File

@@ -0,0 +1,12 @@
# Create a VM for testing Ansible provisioning.
FROM debian:trixie
RUN apt update && apt dist-upgrade -y && apt install -y git bash curl sudo
COPY bin/main.sh /root/main.sh
RUN chmod +x /root/main.sh
WORKDIR /root/
USER root
CMD ./main.sh

View File

@@ -0,0 +1,12 @@
# Create a VM for testing Ansible provisioning.
FROM fedora:latest
RUN dnf upgrade --refresh -y && dnf install -y git bash curl sudo
COPY bin/main.sh /root/main.sh
RUN chmod +x /root/main.sh
WORKDIR /root/
USER root
CMD ./main.sh

View File

@@ -0,0 +1,14 @@
# Create a VM for testing Ansible provisioning.
FROM opensuse/tumbleweed
RUN zypper -n refresh \
&& zypper -n dist-upgrade -y \
&& zypper -n install -y git bash curl sudo
COPY bin/main.sh /root/main.sh
RUN chmod +x /root/main.sh
WORKDIR /root/
USER root
CMD ./main.sh

View File

@@ -0,0 +1,12 @@
# Create a VM for testing Ansible provisioning.
FROM ubuntu:rolling
RUN apt update && apt dist-upgrade -y && apt install -y git bash curl sudo
COPY bin/main.sh /root/main.sh
RUN chmod +x /root/main.sh
WORKDIR /root/
USER root
CMD ./main.sh

View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
sh -c "rm -rfv prov-test"
git clone $REPO --branch=$BRANCH prov-test
cd prov-test
echo "Starting Executable Script"
tail -F /var/mail/mail &
tail -F /var/mail/ansible &
logfile="/root/test.log"
$EXEC > $logfile &
tail -F $logfile
echo "*** Finished $0 @ `date` ***"
wait -n
exit $?

View File

@@ -0,0 +1,136 @@
# Create containers which each execute a provisioning script and exit.
volumes:
pt-storage:
driver: local
driver_opts:
type: none
device: $PT_STORAGE_DIR
o: bind
services:
pt-arch:
container_name: pt-arch
build:
context: ./
dockerfile: Dockerfiles/arch
network: host
restart: no
environment:
- REPO=$REPO
- BRANCH=$BRANCH
- EXEC=$EXEC
volumes:
- type: volume
source: pt-storage
target: /root
volume:
subpath: arch
deploy:
mode: global
resources:
limits:
cpus: $CPU
memory: $RAM
pt-debian:
container_name: pt-debian
build:
context: ./
dockerfile: Dockerfiles/debian
network: host
restart: no
environment:
- REPO=$REPO
- BRANCH=$BRANCH
- EXEC=$EXEC
volumes:
- type: volume
source: pt-storage
target: /root
volume:
subpath: debian
deploy:
mode: global
resources:
limits:
cpus: $CPU
memory: $RAM
pt-ubuntu:
container_name: pt-ubuntu
build:
context: ./
dockerfile: Dockerfiles/ubuntu
network: host
restart: no
environment:
- REPO=$REPO
- BRANCH=$BRANCH
- EXEC=$EXEC
volumes:
- type: volume
source: pt-storage
target: /root
volume:
subpath: ubuntu
deploy:
mode: global
resources:
limits:
cpus: $CPU
memory: $RAM
pt-fedora:
container_name: pt-fedora
build:
context: ./
dockerfile: Dockerfiles/fedora
network: host
restart: no
environment:
- REPO=$REPO
- BRANCH=$BRANCH
- EXEC=$EXEC
volumes:
- type: volume
source: pt-storage
target: /root
volume:
subpath: fedora
deploy:
mode: global
resources:
limits:
cpus: $CPU
memory: $RAM
pt-opensuse:
container_name: pt-opensuse
build:
context: ./
dockerfile: Dockerfiles/opensuse
network: host
restart: no
environment:
- REPO=$REPO
- BRANCH=$BRANCH
- EXEC=$EXEC
volumes:
- type: volume
source: pt-storage
target: /root
volume:
subpath: opensuse
deploy:
mode: global
resources:
limits:
cpus: $CPU
memory: $RAM

View File

@@ -0,0 +1,16 @@
# This file should be renamed '.env' and have any private values modified.
COMPOSE_BAKE=true
## Performance
CPU=0.2
RAM=0.2G
## Storage
#STORAGE_DIR=../../Volumes/ProvisionTests
PT_STORAGE_DIR=/tmp/ProvisionTests
## Script
REPO=https://git.hyperling.com/me/env-ansible
BRANCH=dev
EXEC="./setup.sh -l"

23
Config/ProvisionTests/prep.sh Normal file → Executable file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
# 2025-07-22 Hyperling
# Create the necessary folders for LibreTranslate's volumes to work.
# This must be run before the container will start properly.
## Setup ##
DIR="$(dirname -- "${BASH_SOURCE[0]}")"
source $DIR/.env
source ../../source.env
## Main ##
# Create folders.
mkdir -pv "$PT_STORAGE_DIR/arch"
mkdir -pv "$PT_STORAGE_DIR/debian"
mkdir -pv "$PT_STORAGE_DIR/fedora"
mkdir -pv "$PT_STORAGE_DIR/ubuntu"
mkdir -pv "$PT_STORAGE_DIR/opensuse"
# Finish successfully.
exit 0