-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(examples/config/scp_with_ssh_password): Create example with ssh …
…password, sudo & scp
- Loading branch information
1 parent
11667e4
commit 6d04d6c
Showing
4 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello from Gobble! |