Skip to content

Commit 2b4adb7

Browse files
committed
feat: devcontainer compose
1 parent 0610fef commit 2b4adb7

File tree

4 files changed

+45
-51
lines changed

4 files changed

+45
-51
lines changed

.devcontainer/docker-compose.yml

Lines changed: 24 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,24 @@ services:
77
args:
88
TZ: Europe/Berlin
99
image: ansible-client-debian
10-
# container_name: ansible-client-debian
1110
hostname: debian.client.ansible
1211
environment:
1312
- "TZ=Europe/Berlin"
14-
# volumes:
15-
# - ./ssh-keys/clients/authorized_keys:/root/.ssh/authorized_keys:ro
16-
# - ./ssh-keys/clients/PermitRootLogin.conf:/etc/ssh/sshd_config.d/PermitRootLogin.conf
1713
networks:
1814
- ansible-playground
1915

20-
ansible-client-ubuntu:
21-
build:
22-
context: .
23-
dockerfile: ./Dockerfiles/Dockerfile-Ubuntu-2204
24-
args:
25-
TZ: Europe/Berlin
26-
image: ansible-client-ubuntu
27-
# container_name: ansible-client-ubuntu
28-
hostname: ubuntu.client.ansible
29-
environment:
30-
- "TZ=Europe/Berlin"
31-
# volumes:
32-
# - ./ssh-keys/clients/authorized_keys:/root/.ssh/authorized_keys:ro
33-
# - ./ssh-keys/clients/PermitRootLogin.conf:/etc/ssh/sshd_config.d/PermitRootLogin.conf
34-
networks:
35-
- ansible-playground
16+
# ansible-client-ubuntu:
17+
# build:
18+
# context: .
19+
# dockerfile: ./Dockerfiles/Dockerfile-Ubuntu-2204
20+
# args:
21+
# TZ: Europe/Berlin
22+
# image: ansible-client-ubuntu
23+
# hostname: ubuntu.client.ansible
24+
# environment:
25+
# - "TZ=Europe/Berlin"
26+
# networks:
27+
# - ansible-playground
3628

3729
ansible-client-alma:
3830
build:
@@ -41,32 +33,24 @@ services:
4133
args:
4234
TZ: Europe/Berlin
4335
image: ansible-client-alma
44-
# container_name: ansible-client-alma
4536
hostname: alma.client.ansible
4637
environment:
4738
- "TZ=Europe/Berlin"
48-
# volumes:
49-
# - ./ssh-keys/clients/authorized_keys:/root/.ssh/authorized_keys:ro
50-
# - ./ssh-keys/clients/PermitRootLogin.conf:/etc/ssh/sshd_config.d/PermitRootLogin.conf
5139
networks:
5240
- ansible-playground
5341

54-
ansible-client-suse:
55-
build:
56-
context: .
57-
dockerfile: ./Dockerfiles/Dockerfile-OpenSUSE-Leap-15
58-
args:
59-
TZ: Europe/Berlin
60-
image: ansible-client-suse
61-
# container_name: ansible-client-suse
62-
hostname: suse.client.ansible
63-
environment:
64-
- "TZ=Europe/Berlin"
65-
# volumes:
66-
# - ./ssh-keys/clients/authorized_keys:/root/.ssh/authorized_keys:ro
67-
# - ./ssh-keys/clients/PermitRootLogin.conf:/etc/ssh/sshd_config.d/PermitRootLogin.conf
68-
networks:
69-
- ansible-playground
42+
# ansible-client-suse:
43+
# build:
44+
# context: .
45+
# dockerfile: ./Dockerfiles/Dockerfile-OpenSUSE-Leap-15
46+
# args:
47+
# TZ: Europe/Berlin
48+
# image: ansible-client-suse
49+
# hostname: suse.client.ansible
50+
# environment:
51+
# - "TZ=Europe/Berlin"
52+
# networks:
53+
# - ansible-playground
7054

7155
networks:
7256
ansible-playground:

.devcontainer/scripts/initialize-command.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ if ! find .devcontainer/ssh-keys -type f -name id_rsa | grep -q .; then
4444
-v "${PWD}"/.devcontainer/ssh-keys/server/:/root/.ssh/server \
4545
ansible-client-debian \
4646
bash -c 'ssh-keygen -q -t rsa -b 4096 -f /root/.ssh/server/id_rsa -N "" -C "ansible-playground_$(date +%Y%m%d_%H%M%S)"<<<y >/dev/null'
47-
47+
chmod 600 .devcontainer/ssh-keys/server/id_rsa
4848
echo "Add 'authorized_keys' with root's public key for all clients"
4949
docker run --rm --name tmp_ansible_init -it \
5050
-v "${PWD}"/.devcontainer/ssh-keys/clients/:/root/.ssh/clients \
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
11
#!/usr/bin/env bash
2+
3+
4+
mkdir -p "${HOME}/.ansible/log"
5+
touch "${HOME}/.ansible/log/ansible.log"
6+
mkdir -p "${HOME}/.ansible/retry-files"
7+
8+
### Fix git permissions
9+
if ! git status &>/dev/null; then
10+
git config --global --add safe.directory "${PWD}"
11+
fi

inventory/inventory.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ all:
1515
ansible-client-debian:
1616
ansible_ssh_user: root
1717
ansible_ssh_private_key_file: ~/.ssh/id_rsa
18-
ubuntu:
19-
hosts:
20-
ansible-client-ubuntu:
21-
ansible_ssh_user: root
22-
ansible_ssh_private_key_file: ~/.ssh/id_rsa
18+
# ubuntu:
19+
# hosts:
20+
# ansible-client-ubuntu:
21+
# ansible_ssh_user: root
22+
# ansible_ssh_private_key_file: ~/.ssh/id_rsa
2323
rpm_based:
2424
children:
2525
almalinux:
2626
hosts:
2727
ansible-client-alma:
2828
ansible_ssh_user: root
2929
ansible_ssh_private_key_file: ~/.ssh/id_rsa
30-
suse:
31-
hosts:
32-
ansible-client-suse:
33-
ansible_ssh_user: root
34-
ansible_ssh_private_key_file: ~/.ssh/id_rsa
30+
# suse:
31+
# hosts:
32+
# ansible-client-suse:
33+
# ansible_ssh_user: root
34+
# ansible_ssh_private_key_file: ~/.ssh/id_rsa

0 commit comments

Comments
 (0)