Initial commit
This commit is contained in:
60
compose.yml
Normal file
60
compose.yml
Normal file
@@ -0,0 +1,60 @@
|
||||
services:
|
||||
controller:
|
||||
build:
|
||||
context: ./ansible-controller
|
||||
container_name: ansible-controller
|
||||
volumes:
|
||||
- ./playbooks:/ansible:ro
|
||||
- ./ssh/id_rsa:/home/uansible/.ssh/id_rsa:ro
|
||||
depends_on:
|
||||
- ubuntu
|
||||
- rocky
|
||||
networks:
|
||||
- ansible-net
|
||||
command: >
|
||||
bash -lc "chmod 600 /home/uansible/.ssh/id_rsa"
|
||||
|
||||
ubuntu:
|
||||
image: ubuntu:22.04
|
||||
container_name: ubuntu_node
|
||||
networks:
|
||||
- ansible-net
|
||||
tty: true
|
||||
command: >
|
||||
bash -lc "apt-get update &&
|
||||
apt-get install -y openssh-server sudo python3 &&
|
||||
mkdir -p /var/run/sshd &&
|
||||
useradd -ms /bin/bash uansible &&
|
||||
echo 'uansible ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers &&
|
||||
mkdir -p /home/uansible/.ssh &&
|
||||
cat /ssh/id_rsa.pub >> /home/uansible/.ssh/authorized_keys &&
|
||||
chmod 700 /home/uansible/.ssh &&
|
||||
chmod 600 /home/uansible/.ssh/authorized_keys &&
|
||||
chown -R uansible:uansible /home/uansible/.ssh &&
|
||||
/usr/sbin/sshd -D"
|
||||
volumes:
|
||||
- ./ssh/id_rsa.pub:/ssh/id_rsa.pub:ro
|
||||
|
||||
rocky:
|
||||
image: rockylinux:9
|
||||
container_name: rocky_node
|
||||
networks:
|
||||
- ansible-net
|
||||
tty: true
|
||||
command: >
|
||||
bash -lc "dnf install -y openssh-server sudo python3 &&
|
||||
/usr/bin/ssh-keygen -A &&
|
||||
useradd -ms /bin/bash uansible &&
|
||||
echo 'uansible ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers &&
|
||||
mkdir -p /home/uansible/.ssh &&
|
||||
cat /ssh/id_rsa.pub >> /home/uansible/.ssh/authorized_keys &&
|
||||
chmod 700 /home/uansible/.ssh &&
|
||||
chmod 600 /home/uansible/.ssh/authorized_keys &&
|
||||
chown -R uansible:uansible /home/uansible/.ssh &&
|
||||
/usr/sbin/sshd -D"
|
||||
volumes:
|
||||
- ./ssh/id_rsa.pub:/ssh/id_rsa.pub:ro
|
||||
|
||||
networks:
|
||||
ansible-net:
|
||||
driver: bridge
|
||||
Reference in New Issue
Block a user