Initial commit
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
id_ansible_lab*
|
||||||
|
*.sw*
|
||||||
6
README.md
Normal file
6
README.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# Immagini Docker per lab Ansible
|
||||||
|
|
||||||
|
Il repository include i Dockerfile per tre immagini Docker basate su Debian 13, Almalinux 9 e Ubuntu 24.04 per riprodurre tramite container i sistemi operativi (attualmente) installati sulle VM in produzione al CED di Montelibretti (Area RM 1).
|
||||||
|
|
||||||
|
Per il corretto funzionamento delle immagini, è necessario che esista una chiave pubblica `id_ansible.pub` nelle rispettive cartelle con i Dockerfile. Questa deve ovviamente corrispondere a una chiave SSH privata `id_ansible_lab` che `inventory.yaml` cerca in `~/.ssh/`.
|
||||||
|
|
||||||
29
almalinux/Dockerfile
Normal file
29
almalinux/Dockerfile
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
FROM almalinux:9
|
||||||
|
|
||||||
|
RUN dnf update -y && \
|
||||||
|
dnf install -y \
|
||||||
|
openssh-server \
|
||||||
|
sudo \
|
||||||
|
python3
|
||||||
|
#rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN mkdir /var/run/sshd
|
||||||
|
|
||||||
|
RUN ssh-keygen -A
|
||||||
|
|
||||||
|
RUN useradd -m -s /bin/bash nicolo && \
|
||||||
|
echo "nicolo ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/nicolo
|
||||||
|
|
||||||
|
RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config && \
|
||||||
|
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin no/' /etc/ssh/sshd_config
|
||||||
|
|
||||||
|
RUN mkdir /home/nicolo/.ssh && \
|
||||||
|
chmod 700 /home/nicolo/.ssh
|
||||||
|
|
||||||
|
COPY id_ansible_lab.pub /home/nicolo/.ssh/authorized_keys
|
||||||
|
|
||||||
|
RUN chown nicolo:nicolo -R /home/nicolo/.ssh && chmod 600 /home/nicolo/.ssh/authorized_keys
|
||||||
|
|
||||||
|
EXPOSE 22
|
||||||
|
CMD ["/usr/sbin/sshd", "-D"]
|
||||||
|
|
||||||
26
debian/Dockerfile
vendored
Normal file
26
debian/Dockerfile
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
FROM debian:13
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y \
|
||||||
|
openssh-server \
|
||||||
|
sudo \
|
||||||
|
python3 \
|
||||||
|
ca-certificates && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN useradd -m -s /bin/bash nicolo && \
|
||||||
|
echo "nicolo ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/nicolo
|
||||||
|
|
||||||
|
RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config && \
|
||||||
|
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin no/' /etc/ssh/sshd_config
|
||||||
|
|
||||||
|
RUN mkdir /home/nicolo/.ssh && \
|
||||||
|
chmod 700 /home/nicolo/.ssh
|
||||||
|
|
||||||
|
COPY id_ansible_lab.pub /home/nicolo/.ssh/authorized_keys
|
||||||
|
|
||||||
|
RUN chown nicolo:nicolo -R /home/nicolo/.ssh && chmod 600 /home/nicolo/.ssh/authorized_keys
|
||||||
|
|
||||||
|
EXPOSE 22
|
||||||
|
CMD ["/usr/sbin/sshd", "-D"]
|
||||||
|
|
||||||
28
ubuntu/Dockerfile
Normal file
28
ubuntu/Dockerfile
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
FROM ubuntu:24.04
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y \
|
||||||
|
openssh-server \
|
||||||
|
sudo \
|
||||||
|
python3 \
|
||||||
|
ca-certificates && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN mkdir /var/run/sshd
|
||||||
|
|
||||||
|
RUN useradd -m -s /bin/bash nicolo && \
|
||||||
|
echo "nicolo ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/nicolo
|
||||||
|
|
||||||
|
RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config && \
|
||||||
|
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin no/' /etc/ssh/sshd_config
|
||||||
|
|
||||||
|
RUN mkdir /home/nicolo/.ssh && \
|
||||||
|
chmod 700 /home/nicolo/.ssh
|
||||||
|
|
||||||
|
COPY id_ansible_lab.pub /home/nicolo/.ssh/authorized_keys
|
||||||
|
|
||||||
|
RUN chown nicolo:nicolo -R /home/nicolo/.ssh && chmod 600 /home/nicolo/.ssh/authorized_keys
|
||||||
|
|
||||||
|
EXPOSE 22
|
||||||
|
CMD ["/usr/sbin/sshd", "-D"]
|
||||||
|
|
||||||
Reference in New Issue
Block a user