Skip to content

Commit 6d04d6c

Browse files
committed
feat(examples/config/scp_with_ssh_password): Create example with ssh password, sudo & scp
1 parent 11667e4 commit 6d04d6c

File tree

4 files changed

+50
-0
lines changed

4 files changed

+50
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM sikalabs/sshd
2+
RUN \
3+
apt-get update && \
4+
apt-get install -y --no-install-recommends \
5+
sudo && \
6+
rm -rf /var/lib/apt/lists
7+
RUN useradd demo -s /bin/bash --create-home
8+
RUN echo "demo:demo" | chpasswd
9+
RUN echo "demo ALL=(ALL) ALL" >> /etc/sudoers
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
IMAGE = "scp_with_ssh_password"
2+
3+
run:
4+
docker build --platform linux/amd64 -t $(IMAGE) .
5+
docker run -p 2222:22 --name $(IMAGE) -d $(IMAGE)
6+
sleep 3
7+
@echo
8+
gobble run
9+
@echo
10+
sshpass -p demo ssh ssh://demo@127.0.0.1:2222 cat /hello.txt
11+
sshpass -p demo ssh ssh://demo@127.0.0.1:2222 cat /template.txt
12+
@echo
13+
@make cleanup
14+
15+
cleanup:
16+
docker rm -f $(IMAGE)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
meta:
2+
schema_version: 3
3+
hosts:
4+
all:
5+
- ssh_target: demo@127.0.0.1
6+
ssh_port: 2222
7+
ssh_password: demo
8+
sudo_password: demo
9+
vars:
10+
hello: Ahoj
11+
world: Svete
12+
plays:
13+
- name: Test
14+
hosts: [all]
15+
tasks:
16+
- name: cp
17+
cp:
18+
local_src: hello.txt
19+
remote_dst: /hello.txt
20+
- name: template
21+
template:
22+
path: /template.txt
23+
template: |
24+
{{ .Vars.hello }} {{ .Vars.world }}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello from Gobble!

0 commit comments

Comments
 (0)