Move from docker to qemu
This commit is contained in:
parent
0fa2ed983e
commit
3fbdcc0a51
10 changed files with 31 additions and 21 deletions
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
*.qcow2 filter=lfs diff=lfs merge=lfs -text
|
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
work/image.qcow2
|
||||||
|
work/inventory.yaml
|
|
@ -1,4 +1,4 @@
|
||||||
[defaults]
|
[defaults]
|
||||||
inventory = docker/inventory.yaml
|
inventory = work/inventory.yaml
|
||||||
retry_files_enabled = false
|
retry_files_enabled = false
|
||||||
interpreter_python = auto_silent
|
interpreter_python = auto_silent
|
|
@ -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"]
|
|
|
@ -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
|
|
6
init.sh
6
init.sh
|
@ -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
19
prepare_test_env.sh
Executable 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
4
run.sh
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo "START VM"
|
||||||
|
sudo virsh --connect qemu:///system start FedoraServer --console
|
3
work/base.qcow2
Normal file
3
work/base.qcow2
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:d7bf9670c300ef151defdef9976ab063123e6314ee43f338030f8da046e15572
|
||||||
|
size 1052180480
|
|
@ -3,4 +3,4 @@ servers:
|
||||||
localhost:
|
localhost:
|
||||||
ansible_connection: ssh
|
ansible_connection: ssh
|
||||||
ansible_user: test
|
ansible_user: test
|
||||||
ansible_port: 1022
|
ansible_port: 22
|
Loading…
Reference in a new issue