infra/README.md

83 lines
1.7 KiB
Markdown
Raw Permalink Normal View History

2022-08-29 10:41:38 +00:00
# BIJ1 ansible infrastructure
## usage
2022-08-29 10:44:09 +00:00
### Prerequisites
- [git-crypt](https://www.agwa.name/projects/git-crypt/)
2022-09-21 20:24:02 +00:00
- [Python](https://python.org/) 3
- [Poetry](https://python-poetry.org/)
2023-12-16 19:23:16 +00:00
- target servers: best tested with Debian GNU/Linux 11 (bullseye)
2022-09-21 20:24:02 +00:00
### Install packages
```bash
poetry install
2022-09-21 20:24:02 +00:00
```
2022-08-29 10:41:38 +00:00
### Secrets
To unlock secrets when you want to use this repo:
```bash
git crypt unlock
```
To lock them again after you finish:
```bash
git crypt lock
```
### Bootstapping servers
Add any hosts to bootstap to the `ansible/inventory/hosts` file.
Then, to bootstrap the server `$HOST_NAME` run:
```bash
poetry run debops run bootstrap -l $HOST_NAME -e 'ansible_user=root netbase__hostname_config_enabled=false'
poetry run debops run common -l $HOST_NAME -e 'netbase__hostname_config_enabled=false'
2022-08-29 12:17:37 +00:00
```
After bootstrapping, you can run:
2023-10-07 15:45:53 +00:00
2022-08-29 12:17:37 +00:00
```bash
poetry run debops run common -l $HOST_NAME
poetry run debops run net -l $HOST_NAME
poetry run debops run site -l $HOST_NAME
2022-08-29 10:41:38 +00:00
```
2022-08-29 11:17:09 +00:00
If you'd like to rerun a single service,
e.g. `python` for a log mention of `debops.debops.python`,
run:
```bash
poetry run debops run service/$SERVICE -l $HOST_NAME
2022-08-29 11:17:09 +00:00
```
2022-09-19 20:41:21 +00:00
To get the node on the internal network, on the node in question run:
2023-10-07 15:45:53 +00:00
2022-09-19 20:41:21 +00:00
```bash
sudo rm -rf /etc/network/interfaces.d/old-interfaces
sudo cp /etc/network/interfaces.config.d/* /etc/network/interfaces.d/
sudo reboot
```
## scope
2023-04-21 23:19:45 +00:00
Ansible - debops wordt nu gebruikt voor het regelen van o.a.:
- message of the day (`motd`) die je in de terminal ziet bij het inloggen
- server root wachtwoorden
- firewall gaten
- package updates
nog niet de gehele setups zijn reproducible.
wat ook nog handmatig kan:
- packages installeren
- user accounts
- sudo rechten
- ssh keys