Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pmeinhardt/huck-up
raspberry pi setup β automated, modular and personalized π±
https://github.com/pmeinhardt/huck-up
ansible raspberry-pi
Last synced: 6 days ago
JSON representation
raspberry pi setup β automated, modular and personalized π±
- Host: GitHub
- URL: https://github.com/pmeinhardt/huck-up
- Owner: pmeinhardt
- Created: 2016-07-09T09:36:10.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2020-08-04T22:15:41.000Z (over 4 years ago)
- Last Synced: 2024-11-02T14:42:10.699Z (13 days ago)
- Topics: ansible, raspberry-pi
- Language: Shell
- Homepage:
- Size: 316 KB
- Stars: 10
- Watchers: 5
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Huckleberry - Welcome home [![CircleCI](https://circleci.com/gh/pmeinhardt/huck-up.svg?style=svg)](https://circleci.com/gh/pmeinhardt/huck-up)
My personal [Raspberry Pi](https://www.raspberrypi.org/) (home server) management.
Built using [Ansible](https://github.com/ansible/ansible).
## Components
- **ssh-keys** to copy your public SSH key so you can connect securely without typing your password
- **essentials** installs a few useful server monitoring and common build tools
- **dotfiles** sets up the server dotfiles, including git configuration
- **motd** installs the nice "message of the day" greeting you can see above
- **zsh** sets up Zsh as the default shell (configurable via dotfiles)
- **mosh** installs the [mobile shell](https://github.com/mobile-shell/mosh) remote terminal application
- **python** installs [Python](https://www.python.org/) with pip and pipenv
- **go** installs [Go](https://golang.org/)
- **rust** installs [Rust](https://www.rust-lang.org/) and [Cargo](https://doc.rust-lang.org/cargo/)
- **ruby** installs [rbenv](https://github.com/rbenv/rbenv), [rbenv-update](https://github.com/rkh/rbenv-update) and [ruby-build](https://github.com/rbenv/ruby-build) which you can then use to install a [Ruby](https://www.ruby-lang.org/) of your choice
- **node** installs [Node.js](https://nodejs.org/) and [npm](https://github.com/npm/cli)
- **home** creates a default directory structure in your home directory
- **shairport-sync** builds [Shairport Sync](https://github.com/mikebrady/shairport-sync) for wireless music streaming from your Apple device to your Pi via AirPlay
- **media-tools** installs useful media players, like mplayer
- **hifiberry** configures your Pi to work with the [HiFiBerry](https://www.hifiberry.com/) DAC+ card## Preparations
There are a few things which you'll need to prepare. Here we go:
1. **πΎ Prepare an SD card** Huck-up automates server management using Ansible. Its playbooks are written with Raspbian/Debian systems in mind. If you don't have a Raspberry Pi operating system on an SD card yet, download [Raspbian](https://www.raspberrypi.org/downloads/raspbian/) and [install](https://www.raspberrypi.org/documentation/installation/installing-images/) it.
Note: On Raspbian the SSH server is disabled by default. After installing the image, insert the prepared SD card into your local machine and place an empty `ssh` file onto the boot partition to [enable SSH](https://www.raspberrypi.org/documentation/remote-access/ssh/).
2. **π Get your Pi up.** Push the card into your Pi and power it up.
3. **π Connect your Pi.** Your Raspberry Pi needs to be connected to your local network. Just hook it up to your router with an ethernet cable if you have one, or else configure [WiFi](https://www.raspberrypi.org/documentation/configuration/wireless/).
4. **β Install Ansible.** On your local machine, install [Ansible](http://docs.ansible.com/ansible/intro_installation.html). Alternatively you can also run the huck-up playbook directly on your Pi.
5. **π¦ Clone this repoβ¦** `git clone https://github.com/pmeinhardt/huck-up.git && cd huck-up`
## Provisioning
**Now it is time you adapt the service and deployment configuration to your needs.**
We recommend you keep these versioned in your own fork of this repository.
- Right away, you'll want to edit `base.yml` to your liking and select the roles you need.
- Create a file named `vars/private.yml` and hack away. Values in `private.yml` take precedence over anything defined in `default.yml`. If you're fine with the defaults, just `touch vars/private.yml` and you're done.
- You should probably keep a backup copy of your `private.yml` in a safe place, e.g. in your 1Password vault or somewhere similar.
- Alternatively: You may want to encrypt your `private.yml` using Ansible Vault if you plan on keeping it in your repository. A brief description is presented in a separate section below.
**Be sure not to commit passwords into public repos!**
If you have made changes to your Pi already - in particular if it is available under a different hostname - update the `raspberries` inventory file or create a private copy that you pass to Ansible via the `-i/--inventory` option.
You can verify your Pi is reachable by running:
```shell
ansible --inventory=raspberries --ask-pass --args="/bin/hostname" raspberries
```The default password is `raspberry` (make sure you change it).
**To bootstrap your Pi, run:**
```shell
./script/bootstrap # if you have not changed the default username
./script/bootstrap --user=USERNAME # otherwise
```or, if running [locally](http://docs.ansible.com/ansible/playbooks_delegation.html#local-playbooks) on your Pi:
```shell
# change the "hosts:" entry in base.yml to "hosts: 127.0.0.1", then run:
ansible-playbook base.yml --connection=local
```This will get everything set up and you're good to go.
You might have to reboot your Pi for some changes to take effect, e.g. the HiFiBerry device tree setup.
**You can rerun these commands from time to time in order to keep your Pi up-to-date.**
A handy script to do that for you is available. Just run `./script/update`.
## Encrypting configuration files
If you keep application secrets in your configuration files, you can use [Ansible Vault](http://docs.ansible.com/ansible/playbooks_vault.html) to encrypt them.
When you override the default variables for a deployment for instance, encrypt the variables file as follows:
```
ansible-vault encrypt vars/config.yml
```This will prompt for a password and save the file as encrypted data. When running a playbook containing Vault-encrypted files append `--ask-vault-pass`, i.e. run:
```
ansible-playbook --inventory=raspberries base.yml --extra-vars=@vars/config.yml --ask-vault-pass
```## Creating backups
To come.