Add a simple playbook for testing

This commit is contained in:
Thomas Kleinendorst 2024-04-09 17:03:04 +02:00
parent a0cb9b0024
commit 511de6edfd
4 changed files with 17 additions and 4 deletions

View file

@ -14,9 +14,9 @@ The Raspberry Pi IaC code contained within this repository provisions the Raspbe
3. [Cloudflare](https://dash.cloudflare.com/login) should be setup for managing the domain records of *kleinendorst.info*.
### Raspberry Pi preperation
The Raspberry Pi should be installed and running with reachable SSH from the network.
The Raspberry Pi should be installed and running with reachable SSH from the network.
1. Setup its MicroSD card using the Raspberry Pi Imager ([download](https://www.raspberrypi.com/software/)). For **CHOOSE OS** select the : **Raspberry Pi OS (other)** > **Raspberry Pi OS Lite (64-bit)** option.
1. Setup its MicroSD card using the Raspberry Pi Imager ([download](https://www.raspberrypi.com/software/)). For **CHOOSE OS** select the : **Raspberry Pi OS (other)** > **Raspberry Pi OS Lite (64-bit)** option.
2. When asked: **Would you like to apply OS customisation settings?** select **EDIT SETTINGS**. Select and fill in the following settings:
1. **Set username and password**
2. **Set locale settings**
@ -26,3 +26,10 @@ The Raspberry Pi should be installed and running with reachable SSH from the net
4. Find the assigned IP of the Raspberry Pi in the [router](http://asusrouter.com/) and configure DHCP to statically asign this address to the Raspberry Pi.
5. Add the new Raspberry Pi to the *hosts* file using the internal IP.
6. Test if the Raspberry Pi is correctly configured by opening an SSH session to it (using its IP address). If this works the next step is to [add SSH public keys for each computer that should provision/connect to the Raspberry Pi](https://linuxhandbook.com/add-ssh-public-key-to-server/). **It's important to perform this step before provisioning because that will disallow logging into SSH with a password.**
## Provisioning
Provision the Raspberry Pi by running:
```bash
ansible-playbook -i inventory playbook.yml
```

2
hosts
View file

@ -1,2 +0,0 @@
[raspberry-pis]
192.168.50.27

2
inventory/hosts Normal file
View file

@ -0,0 +1,2 @@
[raspberry_pis]
192.168.50.27

6
playbook.yml Normal file
View file

@ -0,0 +1,6 @@
---
- name: Install raspberry pi
hosts: raspberry_pis
tasks:
- name: Example from an Ansible Playbook
ansible.builtin.ping: