lots of stuff
This commit is contained in:
parent
dac4a98f79
commit
3d3d65575b
11 changed files with 296 additions and 17 deletions
|
|
@ -1,8 +1,8 @@
|
|||
# 01. Infra Setup
|
||||
# 01 Infra Setup
|
||||
|
||||
This describes how to prepare each machine before deploying services on them.
|
||||
|
||||
## 01.01 First steps
|
||||
## First steps
|
||||
|
||||
* Create an ssh key or pick an existing one. We'll refer to it as the `personal_ssh_key`.
|
||||
* Deploy ansible on the laptop (Lapy), which will act as the ansible control node. To do so:
|
||||
|
|
@ -11,26 +11,35 @@ This describes how to prepare each machine before deploying services on them.
|
|||
* Install the listed ansible requirements with `pip install -r requirements.txt`
|
||||
* Keep in mind you should activate this `venv` from now on when running `ansible` commands.
|
||||
|
||||
## 01.02 Prepare the VPS (Vipy)
|
||||
## Domain
|
||||
|
||||
### 01.02.01 Source the VPS
|
||||
* Some services are designed to be accessible through WAN through a friendly URL.
|
||||
* You'll need to have a domain where you can set DNS records and have the ability to create different subdomains, as the guide assumes each service will get its own subdomain.
|
||||
* Getting and configuring the domain is outside the scope of this repo. Whenever a service needs you to set up a subdomain, it will be mentioned explictly.
|
||||
* You should add the domain to the var `root_domain` in `ansible/infra_vars.yml`.
|
||||
|
||||
## Prepare the VPS (Vipy)
|
||||
|
||||
### Source the VPS
|
||||
|
||||
* The guide is agnostic to which provider you pick, but has been tested with VMs from https://lnvps.net.
|
||||
* The expectations are that the VPS ticks the following boxes:
|
||||
+ Runs Debian 12 bookworm.
|
||||
+ Has a public IP4 and starts out with SSH listening on port 22.
|
||||
+ Boots with one of your SSH keys already authorized.
|
||||
* Move on once your VPS is running.
|
||||
+ Boots with one of your SSH keys already authorized. If this is not the case, you'll have to manually drop the pubkey there before using the playbooks.
|
||||
* Move on once your VPS is running and satisfies the prerequisites.
|
||||
|
||||
### 01.02.02 Prepare Ansible vars
|
||||
### Prepare Ansible vars
|
||||
|
||||
* You have an example `ansible/example.inventory.ini`. Copy it with `cp ansible/example.inventory.ini ansible/inventory.ini` and fill in with the values for your VPS.
|
||||
* A few notes:
|
||||
* The guides assume you'll only have one VPS in the `[Vipy]` group. Stuff will break if you have multiple, so avoid that.
|
||||
|
||||
### 01.02.03 Create user and secure VPS access
|
||||
### Create user and secure VPS access
|
||||
|
||||
* Ansible will create a user on the first playbook `01_basic_vps_setup_playbook.yml`. This is the user that will get used regularly. But, since this user doesn't exist, you obviosuly need to first run this playbook from some other user. We assume your VPS provider has given you a root user, which is what you need to define as the running user in the next command.
|
||||
* cd into `ansible`
|
||||
* Run `ansible-playbook -i inventory.ini infra/01_user_and_access_setup_playbook.yml -e 'ansible_user="your root user here"'
|
||||
* Then, configure firewall access, fail2ban and auditd with `ansible-playbook -i inventory.ini infra/02_firewall_playbook.yml`
|
||||
* Run `ansible-playbook -i inventory.ini infra/01_user_and_access_setup_playbook.yml -e 'ansible_user="your root user here"'`
|
||||
* Then, configure firewall access, fail2ban and auditd with `ansible-playbook -i inventory.ini infra/02_firewall_and_fail2ban_playbook.yml`. Since the user we will use is now present, there is no need to specify the user anymore.
|
||||
|
||||
Note that both the root user and the `counterweight` user will use the same SSH pubkey for auth.
|
||||
Note that, by applying this playbooks, both the root user and the `counterweight` user will use the same SSH pubkey for auth.
|
||||
Loading…
Add table
Add a link
Reference in a new issue