Skip to content

Commit 3cac5e4

Browse files
committed
Implement WinSCP Sync and vscode Tasks
1 parent 3f3c862 commit 3cac5e4

13 files changed

+131
-73
lines changed

.vscode/tasks.json

+81-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,95 @@
11
{
22
"version":"2.0.0",
3+
"options": {
4+
"env": {
5+
/* Public FQDN to the Ansible Controller Host*/
6+
"ANSIBLEHOST": "ec2-18-185-24-57.eu-central-1.compute.amazonaws.com",
7+
/* Path to Win SCP Executable*/
8+
"WINSCPEXE": "C:\\Program Files (x86)\\WinSCP\\WinSCP.com",
9+
10+
/* DONT EDIT SOMETHING HERE */
11+
"SSHKEY_FILE": "${workspaceFolder}\\ssh\\workshop.key",
12+
"SSHKEY_PPK_FILE": "${workspaceFolder}\\ssh\\workshop.ppk",
13+
"LOCAL_WORKSHOP_FOLDER": "${workspaceFolder}\\workshop",
14+
"REMOTE_WORKSHOP_FOLDER": "/opt/workshop",
15+
"LOCAL_DEMOS_FOLDER": "${workspaceFolder}\\demos",
16+
"REMOTE_DEMOS_FOLDER": "/opt/demos"
17+
}
18+
},
319
"tasks": [
420
{
5-
"label":"Start WinSCPSync with Ctrl Host",
21+
"label":"Connect to Ansible Controller",
22+
"type": "shell",
23+
"group":{
24+
"kind": "test",
25+
"isDefault": true
26+
},
27+
"windows": {
28+
"command": "ssh",
29+
"args": [
30+
"-i","\"$env:SSHKEY_FILE\"","admin@$($env:ANSIBLEHOST)","-oStrictHostKeyChecking=no"
31+
]
32+
},
33+
"presentation": {
34+
"echo": false,
35+
"reveal": "always",
36+
"focus": true,
37+
"panel": "dedicated",
38+
"showReuseMessage": false,
39+
"clear": false,
40+
"group": "Ansible"
41+
}
42+
},
43+
{
44+
"label":"Automatic Sync Workshop Folder",
45+
"type":"shell",
46+
"group": "test",
47+
"windows": {
48+
"command": "C:\\Program Files (x86)\\WinSCP\\WinSCP.com",
49+
"args": [
50+
"/script=\"${workspaceFolder}\\assets\\mirror-folder-winscp.config\"",
51+
"/nointeractiveinput",
52+
"/parameter",
53+
"\"$env:ANSIBLEHOST\"",
54+
"\"$env:SSHKEY_PPK_FILE\"",
55+
"\"$env:LOCAL_WORKSHOP_FOLDER\"",
56+
"\"$env:REMOTE_WORKSHOP_FOLDER\""
57+
]
58+
},
59+
"presentation": {
60+
"echo": false,
61+
"reveal": "silent",
62+
"focus": false,
63+
"panel": "dedicated",
64+
"showReuseMessage": false,
65+
"clear": false,
66+
"group": "SCP"
67+
}
68+
},
69+
{
70+
"label":"Automatic Sync Demos Folder",
671
"type":"shell",
772
"group": "test",
873
"windows": {
9-
"command": ".\\scripts\\mirror.cmd"
74+
"command": "C:\\Program Files (x86)\\WinSCP\\WinSCP.com",
75+
"args": [
76+
"/script=\"${workspaceFolder}\\assets\\mirror-folder-winscp.config\"",
77+
"/nointeractiveinput",
78+
"/parameter",
79+
"\"$env:ANSIBLEHOST\"",
80+
"\"$env:SSHKEY_PPK_FILE\"",
81+
"\"$env:LOCAL_DEMOS_FOLDER\"",
82+
"\"$env:REMOTE_DEMOS_FOLDER\""
83+
]
1084
},
1185
"presentation": {
12-
"echo": true,
13-
"reveal": "never",
86+
"echo": false,
87+
"reveal": "silent",
1488
"focus": false,
15-
"panel": "new",
89+
"panel": "dedicated",
1690
"showReuseMessage": false,
17-
"clear": false
91+
"clear": false,
92+
"group": "SCP"
1893
}
1994
}
2095
]

README.md

+39-11
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,55 @@ Tages Workshop über Ansible für Entwickler/Techniker
44

55
## Anforderungen
66

7-
**Visual Studio Code** mit folgenden Plugins
7+
**Visual Studio Code** (1.31) mit folgenden Plugins
88

99
- haaaad.ansible
1010

11-
** WinSCP**
11+
**WinSCP**
1212

13-
- mit WinSCP in PATH Variable für mirror.bat Script
13+
- Pfad zu WinSCP.EXE in der task.json ändern
1414

15-
### Konfiguration von mirror.bat
15+
**ssh** - Git for Windows
1616

17-
### Putty
17+
- ssh.exe in der Pfad Variable
1818

19-
SSH Putty key: /vagrant/ssh/putty.workshop.priv.ppk
19+
## Zum Ansible Controller Verbinden
20+
21+
### Configuration
22+
23+
Datei tasks.json anpassen und folgende Variablen Ändern
24+
25+
- **ANSIBLEHOST**: FQDN zum AWS Ansible Controller Host
26+
27+
### Verbinden
28+
29+
- STRG + SHIFT + P
30+
- Run Tasks
31+
- Connect to Ansible Controller
32+
33+
## Automatische Dateisyncronisierung über WinSCP
2034

21-
### SSH Client
35+
### Configuration
2236

23-
```bash
24-
ssh -i vagrant/ssh/workshop.key [email protected]
25-
```
37+
Datei tasks.json anpassen und folgende Variablen Ändern
38+
39+
- **ANSIBLEHOST**: FQDN zum AWS Ansible Controller Host
40+
- **WINSCPEXE**: Vollständiger Pfad zur WinSCP Exe
41+
42+
### Starten der Syncronisation
43+
44+
- STRG + SHIFT + P
45+
- Run Tasks
46+
- Demos: Automatic Sync Demos Folder
47+
- Workshop: Automatic Sync Workshop Folder
48+
49+
## Remote Verbindung zu den AWS Instanzen
50+
51+
### Putty
52+
53+
SSH Putty key: /vagrant/ssh/putty.workshop.priv.ppk
2654

27-
## Ordner
55+
## Projektordner
2856

2957
### environment
3058

assets/mirror-folder-winscp.config

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
open sftp://admin@%1% -privatekey="%2%"
2+
synchronize remote "%3%" "%4%" -delete -mirror -nopermissions
3+
keepuptodate "%3%" "%4%" -delete -nopermissions
4+
exit

demos/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Demos
22

3-
Enthält die Demo Files
3+
Enthält die Demo Files

demos/test/ansible.cfg

-3
This file was deleted.

demos/test/something.yml

Whitespace-only changes.

demos/test/test.ini

-42
This file was deleted.

doc/writeout.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
- Anleitung für Vagrant
2-
- Box Download
3-
- Test
1+
- Writeout Steps for Presentation for each Demo stuff

environment/README.md

-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# Build Workshop Environments in AWS
22

3-
## TODO
4-
5-
- RSYNC / SCP?
6-
73
## Requirements
84

95
ansible

environment/assets/attendant.md.j2

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@
1313
{% if i.platform == "windows" %}
1414
| **Username** | Administrator |
1515
| **Password** | {{ workshop_win_administrator_password }} |
16-
{% endif %}{% endif %}
16+
{% endif %}{% else %}
17+
| **Username** | admin |
18+
{% endif %}
1719
{% endif %}{% endfor %}

environment/env_config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Workshop Setup
22
# Change values Here
33
workshop_instance_name: 'ansible-workshop'
4-
workshop_attendant_count: 2
4+
workshop_attendant_count: 1
55
workshop_ssh_public_key_file: 'ssh/workshop.pub'
66
workshop_win_administrator_password: 'ansible#workshop1'
77

environment/output/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# This is the Environment Build Output folder
22

3-
- Documents for Attentdant will be generated here
3+
- Documents for Attentdant will be generated here

zeitaufzeichnung.xlsx

16 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)