From c0d9f69ee7197c4faca44a6a6ccc560454927c4c Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Tue, 2 May 2023 14:14:39 +0200 Subject: [PATCH] Begin add docker to test ansible test image --- docker/Dockerfile | 7 +++++++ docker/inventory.yaml | 4 ++++ docker/start | 3 +++ 3 files changed, 14 insertions(+) create mode 100644 docker/Dockerfile create mode 100644 docker/inventory.yaml create mode 100755 docker/start diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..8600f3c --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,7 @@ +FROM fedora:38 + +RUN dnf install openssh-server -y +RUN ssh-keygen -A -v + +EXPOSE 22 +CMD ["/usr/sbin/sshd", "-D", "-o", "ListenAddress=0.0.0.0"] \ No newline at end of file diff --git a/docker/inventory.yaml b/docker/inventory.yaml new file mode 100644 index 0000000..d3ff1c3 --- /dev/null +++ b/docker/inventory.yaml @@ -0,0 +1,4 @@ +servers: + localhost: + ansibleConnection: ssh + ansibleUser: root \ No newline at end of file diff --git a/docker/start b/docker/start new file mode 100755 index 0000000..118a776 --- /dev/null +++ b/docker/start @@ -0,0 +1,3 @@ +#!/bin/sh +docker build -t ansible_test:latest docker/ +docker run --rm -d --name ansible_test --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:rw --volume="$HOME/.ssh/id_rsa.pub:/root/.ssh/authorized_keys" -p 1022:22 --cgroupns=host ansible_test:latest \ No newline at end of file