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

@ -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. 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. 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.** 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: