diff --git a/examples/config/scp_with_ssh_password/Dockerfile b/examples/config/scp_with_ssh_password/Dockerfile new file mode 100644 index 0000000..98a06a7 --- /dev/null +++ b/examples/config/scp_with_ssh_password/Dockerfile @@ -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 diff --git a/examples/config/scp_with_ssh_password/Makefile b/examples/config/scp_with_ssh_password/Makefile new file mode 100644 index 0000000..adb2fb9 --- /dev/null +++ b/examples/config/scp_with_ssh_password/Makefile @@ -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://demo@127.0.0.1:2222 cat /hello.txt + sshpass -p demo ssh ssh://demo@127.0.0.1:2222 cat /template.txt + @echo + @make cleanup + +cleanup: + docker rm -f $(IMAGE) diff --git a/examples/config/scp_with_ssh_password/gobblefile.yml b/examples/config/scp_with_ssh_password/gobblefile.yml new file mode 100644 index 0000000..fa57be0 --- /dev/null +++ b/examples/config/scp_with_ssh_password/gobblefile.yml @@ -0,0 +1,24 @@ +meta: + schema_version: 3 +hosts: + all: + - ssh_target: demo@127.0.0.1 + 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 }} diff --git a/examples/config/scp_with_ssh_password/hello.txt b/examples/config/scp_with_ssh_password/hello.txt new file mode 100644 index 0000000..8faf0a6 --- /dev/null +++ b/examples/config/scp_with_ssh_password/hello.txt @@ -0,0 +1 @@ +Hello from Gobble!