1
0
Fork 0

Move from docker to qemu

This commit is contained in:
Florian RICHER 2023-05-03 21:13:44 +02:00
parent 0fa2ed983e
commit 3fbdcc0a51
10 changed files with 31 additions and 21 deletions

1
.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
*.qcow2 filter=lfs diff=lfs merge=lfs -text

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
work/image.qcow2
work/inventory.yaml

View file

@ -1,4 +1,4 @@
[defaults]
inventory = docker/inventory.yaml
inventory = work/inventory.yaml
retry_files_enabled = false
interpreter_python = auto_silent

View file

@ -1,10 +0,0 @@
FROM fedora:38
RUN dnf install openssh-server -y
RUN ssh-keygen -A -v
RUN useradd -m -G wheel test
RUN echo 'test:test' | chpasswd
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D", "-o", "ListenAddress=0.0.0.0"]

View file

@ -1,3 +0,0 @@
#!/bin/sh
docker build -t ansible_test:latest docker/
docker run --rm -d --name ansible_test --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:rw -v $HOME/.ssh/id_rsa.pub:/home/test/.ssh/authorized_keys:ro -p 1022:22 --cgroupns=host ansible_test:latest

View file

@ -1,6 +0,0 @@
#!/bin/bash
# Must be run as sudo
cp ./firewall /etc/init.d/firewall
chmod +x /etc/init.d/firewall
update-rc.d firewall defaults

19
prepare_test_env.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/sh
#echo "DOWNLOAD FEDORA IMAGE"
#mkdir -p work
#wget --show-progress -nc -c -O work/image.qcow2 https://download.fedoraproject.org/pub/fedora/linux/releases/38/Server/x86_64/images/Fedora-Server-KVM-38-1.6.x86_64.qcow2
#echo "PREPARE IMG"
#qemu-img resize work/image.qcow2 30G
echo "COPY BASE IMG"
cp work/base.qcow2 work/image.qcow2
sudo virt-install --name FedoraServer \
--memory 8192 --cpu host --vcpus 4 --graphics none \
--os-variant fedora-unknown \
--import \
--disk work/image.qcow2,format=qcow2,bus=virtio \
--network type=direct,source=enp8s0,source_mode=bridge,model=virtio \
--network bridge=virbr0,model=virtio

4
run.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/sh
echo "START VM"
sudo virsh --connect qemu:///system start FedoraServer --console

3
work/base.qcow2 Normal file
View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d7bf9670c300ef151defdef9976ab063123e6314ee43f338030f8da046e15572
size 1052180480

View file

@ -3,4 +3,4 @@ servers:
localhost:
ansible_connection: ssh
ansible_user: test
ansible_port: 1022
ansible_port: 22