Skip to content

Commit ff571d9

Browse files
lorcanraegithub-actions
andauthored
Automated Setup - Windows Usernames and GH SSH key pw (#74)
* refactor: playbook 2 ssh password fix * chore: minor semantic changes for readability * feature: windows - explicitily add SSH username to ssh conf * setup guides generated * chore: Windows - simplify ssh conf username verify * revert: ansible playbook 2 ssh keys * chore: playbook 1 - minor semantics, playbook 2 - ssh pw note added * setup guides generated * chore: playbook 2 instructions semantic updates * setup guides generated --------- Co-authored-by: github-actions <github-actions@github.com>
1 parent 2a8d968 commit ff571d9

10 files changed

Lines changed: 150 additions & 42 deletions

File tree

LINUX.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ There will be copying and pasting of terminal commands in this Setup Guide. Ther
5151

5252
Let's start :rocket:
5353

54-
---
55-
5654
# Part 1: Local Setup
5755

5856

@@ -586,7 +584,7 @@ Terraform is telling you what it will create:
586584
- A compute engine instance
587585
- A static external IP address
588586

589-
**❗ If you have any errors, read the error and debug. If you need some help, raise a ticket with a teacher. ❗**
587+
**❗ If you have any errors, read the error and debug. If you are unsure, raise a ticket with a teacher. ❗**
590588

591589
If everything was successful, create your VM with:
592590

@@ -658,13 +656,13 @@ Notice the connection in the very bottom-left corner of your VS Code window. It
658656
If you want to view your SSH configuration:
659657
1. Start by clicking the symbol in the bottom-left corner of VS Code
660658
2. Click on **Connect to Host...**
661-
3. Click on **Configure SSH Hosts...***
659+
3. Click on **Configure SSH Hosts...**
662660
4. Select the configuration file. Usually the file at the top of the list.
663661
5. View your configuration file! You may need to edit this configuration if you change computers, or want to work on more than one computer during the bootcamp.
664662

665663
</details>
666664

667-
Congratulations, the setup of you local laptop is complete 🎉 We just need to fine tune your Virtual Machine 🪛
665+
Congratulations, the setup of you local computer is complete 🎉 We just need to fine tune your Virtual Machine 🪛
668666

669667
---
670668

@@ -793,7 +791,7 @@ cd ~/vm-ansible-setup && ansible-playbook playbooks/setup_vm_part1.yml
793791

794792
And the playbook should start running!
795793

796-
❗ If an errors occur, raise a ticket with a teacher. The ansible playbooks are designed so that they can be run again, and again, and again and only make the changes that are required.
794+
❗ If an errors occur, raise a ticket with a teacher. The ansible playbooks are designed so that they can be run again, and again, and again and only make the changes that are required (a cool concept called _Idempotency_ that you'll learn about later 😉).
797795

798796
### What is the playbook installing?
799797

@@ -810,7 +808,7 @@ While this playbook is running, lets go through what is being installed and conf
810808

811809
The playbook is also running checks to see if things are installed or not. This is so you can safely re-run the playbook without any problems.
812810

813-
💡 Curious about how Ansible playbooks are defined, take a look at the playbook being run at this [link here 🔗](https://github.com/lewagon/data-engineering-setup/blob/main-automation/automation/vm-ansible-setup/playbooks/setup_vm_part1.yml)
811+
💡 Curious about how Ansible playbooks are defined, take a look at the playbooks' source code at this [link here 🔗](https://github.com/lewagon/data-engineering-setup/blob/main-automation/automation/vm-ansible-setup/playbooks/setup_vm_part1.yml). You might not understand exactly what is happening, but should be able to identify the different tasks.
814812

815813

816814
## GitHub CLI
@@ -883,7 +881,7 @@ Open a ticket with a TA and do one of the following:
883881
- Compare your existing dotfiles with the current Le Wagon [dotfiles 🔗](https://github.com/lewagon/dotfiles), particularly the `.zshrc` and `settings.json` - if there is no meaningful difference, continue with the setup.
884882
- If you are OK with losing your existing dotfiles - delete your existing dotfiles repository on GitHub and continue with the setup
885883
- If you do not want to lose your existing dotfiles, we recommend working with branches:
886-
- On your **laptop**, or wherever you have a **local** copy of **your** copy of dotfiles
884+
- On your **laptop**, or wherever you have a **local** copy of **your existing version of dotfiles**
887885
- Create a branch of your existing dotfiles setup, and push to GitHub - `origin <branchname>`
888886
- On `local main` (or a new named branch), pull from `upstream main`, resolve any conflicts, commit, and push. It is important that you accept incoming changes to the `.zshrc` and `settings.json` files
889887
- Continue with the setup
@@ -968,7 +966,11 @@ cd ~/vm-ansible-setup && ansible-playbook playbooks/setup_vm_part2.yml
968966

969967
And the playbook should start running! If you're asked if you want VS Code to behave more like Sublime Text, click accept.
970968

971-
❗ If any errors occur, raise a ticket with a teacher. You can safely run the playbook again.
969+
**If you created a password for your GitHub SSH key**
970+
- You may be asked to type in your password during the playbook run
971+
- The task: **Clone data-engineering-challenges from your GitHub to VM** will fail. This is OK and expected with how SSH keys work and how the playbooks are modifying your configuration. To resolve, in your terminal run: `exec zsh`, and then re-run the playbook.
972+
973+
❗ If any other errors occur, or your are unsure, raise a ticket with a teacher. You can safely run the playbook again and again. Generally, if the playbook runs from start to finish with no errors, everything should be good!
972974

973975
### What is the playbook installing?
974976

WINDOWS.md

Lines changed: 62 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ There will be copying and pasting of terminal commands in this Setup Guide. Ther
5151

5252
Let's start :rocket:
5353

54-
---
55-
5654
# Part 1: Local Setup
5755

5856

@@ -485,7 +483,7 @@ We'll need to change some values in this file. Here's were you can find the requ
485483
- **region:** take a look at the GCP Region and Zone documentation at this [link here](https://cloud.google.com/compute/docs/regions-zones#available). We generally recommend you choose a geographically nearby region.
486484
- **zone:** Zone is a subset of region. it is almost always the same as **region** appended with `-a`, `-b`, or `-c`. The zone you select within a region should not have a functional impact.
487485
- **instance_name:** we recommend naming your VM: `lw-de-vm-<YOUR_GITHUB_USERNAME>`. Replacing `<YOUR_GITHUB_USERNAME>` with your GitHub username.
488-
- **instance_user:** in Command Prompt, run `echo %username%`, and enter the value
486+
- **instance_user:** in Command Prompt, run `echo %username%`, and enter the value - try and remember your username, you will need it later on
489487

490488
After completing this file, it might look similar to:
491489

@@ -525,7 +523,7 @@ Terraform is telling you what it will create:
525523
- A compute engine instance
526524
- A static external IP address
527525

528-
**❗ If you have any errors, read the error and debug. If you need some help, raise a ticket with a teacher. ❗**
526+
**❗ If you have any errors, read the error and debug. If you are unsure, raise a ticket with a teacher. ❗**
529527

530528
If everything was successful, create your VM with:
531529

@@ -564,6 +562,56 @@ For example, try running:
564562
# $ ssh lw-de-vm-<GITHUB_USERNAME>.<GCP_ZONE>.<GCP_PROJECT_ID>
565563
```
566564

565+
### Confirm Your SSH Settings
566+
567+
Let's take a look at the SSH configuration that was just created and verify it. In VS Code:
568+
569+
1. Open the **command palette** with `ctrl + shift + P` and type in: _remote ssh config_
570+
2. Select the option: **Remote-SSH: Open SSH Configuration File...**
571+
3. In the next menu, select: the file that looks like: **C:\Users\YOUR_USERNAME\.ssh\config**
572+
4. And a file should open that looks similar too:
573+
574+
```bash
575+
# Google Compute Engine Section
576+
#
577+
# The following has been auto-generated by "gcloud compute config-ssh"
578+
# to make accessing your Google Compute Engine virtual machines easier.
579+
#
580+
# To remove this blob, run:
581+
#
582+
# gcloud compute config-ssh --remove
583+
#
584+
# You can also manually remove this blob by deleting everything from
585+
# here until the comment that contains the string "End of Google Compute
586+
# Engine Section".
587+
#
588+
# You should not hand-edit this section, unless you are deleting it.
589+
#
590+
Host lw-de-vm-tswift.europe-west1-b.wagon-bootcamp
591+
HostName 34.0.248.237
592+
IdentityFile C:\Users\TaylorSwift\.ssh\google_compute_engine
593+
UserKnownHostsFile=C:\Users\TaylorSwift\.ssh\google_compute_known_hosts
594+
HostKeyAlias=compute.1637400398547578470
595+
IdentitiesOnly=yes
596+
CheckHostIP=no
597+
598+
# End of Google Compute Engine Section
599+
```
600+
601+
A bit happening here, most of it is documentation and context. Because of some quirks with Windows, we are in fact going to edit this file by hand. We want to add a new `User YOUR_USERNAME` key-value pair to the SSH connection configuration block. In the indented section after `CheckHostIP=no`, add a new `User` label with the value of your Windows username. For example: If the output of `echo %username%` in command prompt was `TaylorSwift`, my updated configuration would be:
602+
603+
```bash
604+
Host lw-de-vm-tswift.europe-west1-b.wagon-bootcamp
605+
HostName 34.0.248.237
606+
IdentityFile C:\Users\TaylorSwift\.ssh\google_compute_engine
607+
UserKnownHostsFile=C:\Users\TaylorSwift\.ssh\google_compute_known_hosts
608+
HostKeyAlias=compute.1637400398547578470
609+
IdentitiesOnly=yes
610+
CheckHostIP=no
611+
User TaylorSwift # <-- Add User label here
612+
```
613+
614+
567615
### SSH File Permissions
568616

569617
Windows has strict permissions for SSH files by default, we need to alter some permissions on the SSH configuration that was created by `gcloud` so VS Code can read the files and manage the SSH connection.
@@ -618,13 +666,13 @@ Notice the connection in the very bottom-left corner of your VS Code window. It
618666
If you want to view your SSH configuration:
619667
1. Start by clicking the symbol in the bottom-left corner of VS Code
620668
2. Click on **Connect to Host...**
621-
3. Click on **Configure SSH Hosts...***
669+
3. Click on **Configure SSH Hosts...**
622670
4. Select the configuration file. Usually the file at the top of the list.
623671
5. View your configuration file! You may need to edit this configuration if you change computers, or want to work on more than one computer during the bootcamp.
624672

625673
</details>
626674

627-
Congratulations, the setup of you local laptop is complete 🎉 We just need to fine tune your Virtual Machine 🪛
675+
Congratulations, the setup of you local computer is complete 🎉 We just need to fine tune your Virtual Machine 🪛
628676

629677
---
630678

@@ -753,7 +801,7 @@ cd ~/vm-ansible-setup && ansible-playbook playbooks/setup_vm_part1.yml
753801

754802
And the playbook should start running!
755803

756-
❗ If an errors occur, raise a ticket with a teacher. The ansible playbooks are designed so that they can be run again, and again, and again and only make the changes that are required.
804+
❗ If an errors occur, raise a ticket with a teacher. The ansible playbooks are designed so that they can be run again, and again, and again and only make the changes that are required (a cool concept called _Idempotency_ that you'll learn about later 😉).
757805

758806
### What is the playbook installing?
759807

@@ -770,7 +818,7 @@ While this playbook is running, lets go through what is being installed and conf
770818

771819
The playbook is also running checks to see if things are installed or not. This is so you can safely re-run the playbook without any problems.
772820

773-
💡 Curious about how Ansible playbooks are defined, take a look at the playbook being run at this [link here 🔗](https://github.com/lewagon/data-engineering-setup/blob/main-automation/automation/vm-ansible-setup/playbooks/setup_vm_part1.yml)
821+
💡 Curious about how Ansible playbooks are defined, take a look at the playbooks' source code at this [link here 🔗](https://github.com/lewagon/data-engineering-setup/blob/main-automation/automation/vm-ansible-setup/playbooks/setup_vm_part1.yml). You might not understand exactly what is happening, but should be able to identify the different tasks.
774822

775823

776824
## GitHub CLI
@@ -843,7 +891,7 @@ Open a ticket with a TA and do one of the following:
843891
- Compare your existing dotfiles with the current Le Wagon [dotfiles 🔗](https://github.com/lewagon/dotfiles), particularly the `.zshrc` and `settings.json` - if there is no meaningful difference, continue with the setup.
844892
- If you are OK with losing your existing dotfiles - delete your existing dotfiles repository on GitHub and continue with the setup
845893
- If you do not want to lose your existing dotfiles, we recommend working with branches:
846-
- On your **laptop**, or wherever you have a **local** copy of **your** copy of dotfiles
894+
- On your **laptop**, or wherever you have a **local** copy of **your existing version of dotfiles**
847895
- Create a branch of your existing dotfiles setup, and push to GitHub - `origin <branchname>`
848896
- On `local main` (or a new named branch), pull from `upstream main`, resolve any conflicts, commit, and push. It is important that you accept incoming changes to the `.zshrc` and `settings.json` files
849897
- Continue with the setup
@@ -928,7 +976,11 @@ cd ~/vm-ansible-setup && ansible-playbook playbooks/setup_vm_part2.yml
928976

929977
And the playbook should start running! If you're asked if you want VS Code to behave more like Sublime Text, click accept.
930978

931-
❗ If any errors occur, raise a ticket with a teacher. You can safely run the playbook again.
979+
**If you created a password for your GitHub SSH key**
980+
- You may be asked to type in your password during the playbook run
981+
- The task: **Clone data-engineering-challenges from your GitHub to VM** will fail. This is OK and expected with how SSH keys work and how the playbooks are modifying your configuration. To resolve, in your terminal run: `exec zsh`, and then re-run the playbook.
982+
983+
❗ If any other errors occur, or your are unsure, raise a ticket with a teacher. You can safely run the playbook again and again. Generally, if the playbook runs from start to finish with no errors, everything should be good!
932984

933985
### What is the playbook installing?
934986

_partials/dotfiles_simple.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Open a ticket with a TA and do one of the following:
1616
- Compare your existing dotfiles with the current Le Wagon [dotfiles 🔗](https://github.com/lewagon/dotfiles), particularly the `.zshrc` and `settings.json` - if there is no meaningful difference, continue with the setup.
1717
- If you are OK with losing your existing dotfiles - delete your existing dotfiles repository on GitHub and continue with the setup
1818
- If you do not want to lose your existing dotfiles, we recommend working with branches:
19-
- On your **laptop**, or wherever you have a **local** copy of **your** copy of dotfiles
19+
- On your **laptop**, or wherever you have a **local** copy of **your existing version of dotfiles**
2020
- Create a branch of your existing dotfiles setup, and push to GitHub - `origin <branchname>`
2121
- On `local main` (or a new named branch), pull from `upstream main`, resolve any conflicts, commit, and push. It is important that you accept incoming changes to the `.zshrc` and `settings.json` files
2222
- Continue with the setup

_partials/intro.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,4 @@ There will be copying and pasting of terminal commands in this Setup Guide. Ther
5151

5252
Let's start :rocket:
5353

54-
---
55-
5654
# Part 1: Local Setup

_partials/terraform_vm.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ $MAC_START
126126
- **instance_user:** in your terminal, run `whoami`, and enter the value
127127
$MAC_END
128128
$WINDOWS_START
129-
- **instance_user:** in Command Prompt, run `echo %username%`, and enter the value
129+
- **instance_user:** in Command Prompt, run `echo %username%`, and enter the value - try and remember your username, you will need it later on
130130
$WINDOWS_END
131131
$LINUX_START
132132
- **instance_user:** in your terminal, run `whoami`, and enter the value
@@ -178,7 +178,7 @@ Terraform is telling you what it will create:
178178
- A compute engine instance
179179
- A static external IP address
180180

181-
**❗ If you have any errors, read the error and debug. If you need some help, raise a ticket with a teacher. ❗**
181+
**❗ If you have any errors, read the error and debug. If you are unsure, raise a ticket with a teacher. ❗**
182182

183183
If everything was successful, create your VM with:
184184

_partials/ubuntu_ansible_part1.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ cd ~/vm-ansible-setup && ansible-playbook playbooks/setup_vm_part1.yml
4646

4747
And the playbook should start running!
4848

49-
❗ If an errors occur, raise a ticket with a teacher. The ansible playbooks are designed so that they can be run again, and again, and again and only make the changes that are required.
49+
❗ If an errors occur, raise a ticket with a teacher. The ansible playbooks are designed so that they can be run again, and again, and again and only make the changes that are required (a cool concept called _Idempotency_ that you'll learn about later 😉).
5050

5151
### What is the playbook installing?
5252

@@ -63,4 +63,4 @@ While this playbook is running, lets go through what is being installed and conf
6363

6464
The playbook is also running checks to see if things are installed or not. This is so you can safely re-run the playbook without any problems.
6565

66-
💡 Curious about how Ansible playbooks are defined, take a look at the playbook being run at this [link here 🔗](https://github.com/lewagon/data-engineering-setup/blob/main-automation/automation/vm-ansible-setup/playbooks/setup_vm_part1.yml)
66+
💡 Curious about how Ansible playbooks are defined, take a look at the playbooks' source code at this [link here 🔗](https://github.com/lewagon/data-engineering-setup/blob/main-automation/automation/vm-ansible-setup/playbooks/setup_vm_part1.yml). You might not understand exactly what is happening, but should be able to identify the different tasks.

_partials/ubuntu_ansible_part2.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ cd ~/vm-ansible-setup && ansible-playbook playbooks/setup_vm_part2.yml
2020

2121
And the playbook should start running! If you're asked if you want VS Code to behave more like Sublime Text, click accept.
2222

23-
❗ If any errors occur, raise a ticket with a teacher. You can safely run the playbook again.
23+
**If you created a password for your GitHub SSH key**
24+
- You may be asked to type in your password during the playbook run
25+
- The task: **Clone data-engineering-challenges from your GitHub to VM** will fail. This is OK and expected with how SSH keys work and how the playbooks are modifying your configuration. To resolve, in your terminal run: `exec zsh`, and then re-run the playbook.
26+
27+
❗ If any other errors occur, or your are unsure, raise a ticket with a teacher. You can safely run the playbook again and again. Generally, if the playbook runs from start to finish with no errors, everything should be good!
2428

2529
### What is the playbook installing?
2630

0 commit comments

Comments
 (0)