61 lines
1.6 KiB
Markdown
61 lines
1.6 KiB
Markdown
# Robot Setup — Ansible
|
|
|
|
Automates provisioning of the Raspbot V2 target (`raspbot-v2.local`).
|
|
|
|
## What it does
|
|
|
|
| Step | Detail |
|
|
|---|---|
|
|
| Enable SPI | Runs `raspi-config nonint do_spi 0` so the hardware interface is available at boot |
|
|
| Install Docker | Uses the [`geerlingguy.docker`](https://galaxy.ansible.com/geerlingguy/docker) role |
|
|
|
|
## Prerequisites
|
|
|
|
- Ansible installed on your local machine (`pip install ansible`)
|
|
- SSH access to `raspbot-v2.local` (key-based auth recommended)
|
|
- The target is running Raspberry Pi OS
|
|
|
|
## Configuration
|
|
|
|
Before running the playbook, set `robot_user` in `inventory.ini` to the non-root user account on the robot (i.e. the username you configured during imaging):
|
|
|
|
```ini
|
|
[raspbot:vars]
|
|
robot_user=matt
|
|
```
|
|
|
|
This user will be added to the `docker` group so that Docker commands can be run without `sudo`.
|
|
|
|
## Usage
|
|
|
|
**1. Install the required role:**
|
|
|
|
```bash
|
|
ansible-galaxy install -r ansible/requirements.yml
|
|
```
|
|
|
|
**2. Run the playbook:**
|
|
|
|
The playbook runs tasks as root (`become: true`), so Ansible needs the sudo password for the remote user. Always include `-K`:
|
|
|
|
```bash
|
|
ansible-playbook -i ansible/inventory.ini ansible/setup_robot.yml -K
|
|
```
|
|
|
|
If you haven't set up SSH key-based auth yet, also add `-k` to prompt for the SSH password:
|
|
|
|
```bash
|
|
ansible-playbook -i ansible/inventory.ini ansible/setup_robot.yml -k -K
|
|
```
|
|
|
|
The SSH user is taken from `robot_user` in `inventory.ini`, so there is no need to pass `-u` separately.
|
|
|
|
## Files
|
|
|
|
```
|
|
ansible/
|
|
├── inventory.ini # Defines the raspbot-v2.local host
|
|
├── requirements.yml # Ansible Galaxy role dependencies
|
|
└── setup_robot.yml # Main playbook
|
|
```
|