Skip to content

Commit

Permalink
feat(examples/config/scp_with_ssh_password): Create example with ssh …
Browse files Browse the repository at this point in the history
…password, sudo & scp
  • Loading branch information
ondrejsika committed Jan 27, 2024
1 parent 11667e4 commit 6d04d6c
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/config/scp_with_ssh_password/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM sikalabs/sshd
RUN \
apt-get update && \
apt-get install -y --no-install-recommends \
sudo && \
rm -rf /var/lib/apt/lists
RUN useradd demo -s /bin/bash --create-home
RUN echo "demo:demo" | chpasswd
RUN echo "demo ALL=(ALL) ALL" >> /etc/sudoers
16 changes: 16 additions & 0 deletions examples/config/scp_with_ssh_password/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
IMAGE = "scp_with_ssh_password"

run:
docker build --platform linux/amd64 -t $(IMAGE) .
docker run -p 2222:22 --name $(IMAGE) -d $(IMAGE)
sleep 3
@echo
gobble run
@echo
sshpass -p demo ssh ssh://[email protected]:2222 cat /hello.txt
sshpass -p demo ssh ssh://[email protected]:2222 cat /template.txt
@echo
@make cleanup

cleanup:
docker rm -f $(IMAGE)
24 changes: 24 additions & 0 deletions examples/config/scp_with_ssh_password/gobblefile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
meta:
schema_version: 3
hosts:
all:
- ssh_target: [email protected]
ssh_port: 2222
ssh_password: demo
sudo_password: demo
vars:
hello: Ahoj
world: Svete
plays:
- name: Test
hosts: [all]
tasks:
- name: cp
cp:
local_src: hello.txt
remote_dst: /hello.txt
- name: template
template:
path: /template.txt
template: |
{{ .Vars.hello }} {{ .Vars.world }}
1 change: 1 addition & 0 deletions examples/config/scp_with_ssh_password/hello.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello from Gobble!

0 comments on commit 6d04d6c

Please sign in to comment.