2
0
Fork 0

update readme, etc.

This commit is contained in:
Luca Bilke 2024-05-22 13:29:56 +02:00
parent 7f52e47c25
commit 163f770e2b
No known key found for this signature in database
GPG Key ID: B753481DA0B6FA47
7 changed files with 69 additions and 10 deletions

View File

@ -1,5 +1,63 @@
# Beispiel Ansible
## Erste schritte
```sh
# Installiere ansible
apt update
apt install -y ansible
# Kopiere die "skeleton" rolle
cp -r roles/{skeleton,webserver}
# Editiere die inventory datei
$EDITOR inventory
```
Wenn die rolle kopiert ist, musst du sie in der `site.yml` noch importieren:
```yaml
- name: Import webserver role
hosts:
- all
roles:
- webserver
```
## Relevante befehle/tasks
### Rolle ausführen
```sh
# Auf deinem Rechner
ansible-playbook site.yml
```
### Webserver neuladen
```sh
# Auf dem Raspi
sudo nginx -s reload
```
(oder)
```yaml
# In deiner Rolle
- name: Reload nginx
ansible.builtin.systemd_service:
name: nginx
state: reloaded
```
## TODO
- [ ] Write a proper readme for the poor intern cursed with this playbook
- [ ] Installiere einen Webserver (apache/traefik/nginx/lighttpd)
- [ ] Serviere `files/index.html` (unter `/var/www/html/index.html` ablegen)
- [ ] Bonusaufgabe: aktiviere eine Password-Authentifizierung (Basic Auth)
## Relevante Dokumentation
- [Paket Installieren](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/package_module.html)
- [Datei kopieren](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/file_module.html)
- [NGINX basic auth](https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/)

1
files/index.html Normal file
View File

@ -0,0 +1 @@
<img src="https://snaile.de/glizzy.gif">

View File

@ -1,2 +1,2 @@
---
# defaults file for basic
# defaults file for skeleton

View File

@ -1,2 +1,2 @@
---
# handlers file for basic
# handlers file for skeleton

View File

@ -1,2 +1,2 @@
---
# tasks file for basic
# tasks file for skeleton

View File

@ -1,2 +1,2 @@
---
# vars file for basic
# vars file for skeleton

View File

@ -1,6 +1,6 @@
---
- name: Import example role
hosts:
- all
roles:
- example
# - name: Import skeleton role
# hosts:
# - all
# roles:
# - skeleton