Skip to content
This repository has been archived by the owner on Apr 18, 2020. It is now read-only.

bcomnes/sbc-bootstrap

Repository files navigation

Raspberry Pi Arch Linux ARM Ansible Playbooks

NOTE: DEPRECIATED IN FAVOR OF https://github.com/bcomnes/raspi-packer

Featuruing C4 Labs Zebra Bold Case

Intro readings:

Arch is a difficult OS for beginners because it requires a fairly comprehensive understanding of how Linux systems are put together.

This repo provides sane base configuration through a minimal boostraping playbook and (soon) a collection of optional roles approrpirate for a raspi2 to serve different roles.

For new SD Cards

New SD cards need to be formatted a special way. Use sdformatter

  • brew cask info sdformatter
  • brew cask install sdformatter (requires sudo)

Select Overwrite Format. This takes about 10 mins for a 32Gb flash drive. Only need to do this once.

Installing Arch the hard way

...Or at least way that I had to do it.

Requirements:

  • 2 USB sticks
  • A macbook pro with an SD card reader.
  • A second laptop for reference
  • Magnifying glass if you have a retina mac

Step 1

Download the arch install media. We are using it to live boot so that we can partition the SD card correctly.

The file will have a name like: archlinux-2015.06.01-dual.iso

Step 2

Follow the Arch Wiki instructions on getting this onto one of your USB drives.

Step 3

Restart your computer, and hold down Option while it reboots. Select the USB stick to boot from.

Step 4

Run lsblk to list all your connected devices. Insert the SD card and run lsblk again. Notice what was added. This is the SD card. It should be something like /dev/sdb.

Step 5

Follow the partitioning instructions on the Arch ARM website:

Its unlikely you will be able to get the wifi or ethernet drivers working in the arch live boot. This requires the Internet to which your system does not have access too. Just download the Arch install archive to a second thumbdrive on a different computer, and move it over to the live boot and continue the directions.

Arch should now be read to go on the SD card and should boot fine.

Installing Arch the easy way

Requirements:

  • USB SD Card Reader

Use vagrant + virtual box + a 3rd party USB SD card reader. This way you can vagrant up a linux VM, mount the 3rd part USB SD card reader as a USB device and simply follow the standard directions. 3rd party SD card readers should be able to mount inside Guest Machines.

Pre-playbook considerations

As root:

$ pacman -S etckeeper
$ cd /etc
$ etckeeper init
$ git add -A ; git commit -m 'Initial commit'
```to

Useful for keeping track of changes

## Ansible pitfalls

- Homebrew's ansible cant connect to a remote Arch system using `--ask-pass`.

```js
{'msg': 'FAILED: Incompatible ssh peer (no acceptable kex algorithm)', 'failed': True}

guess there is no specific version, you might have bigger issue with newer openssh and very old paramiko not having cyphers in common

openssh might not be as happy with older versions which ansible might tolerate -- @bcoca

ansible_python_interpreter=/usr/bin/python2
  • Ansible's hostname module doesn't work with arch. Its a bug. Float this patch: 8679.patch as of Ansible 1.9.1. Should be fixed in the next ansible release.
$ cd /usr/local/lib/python2.7/site-packages/ansible
$ wget https://github.com/ansible/ansible/pull/8679.patch
$ patch -p3 < 8679.patch

Setting up the play

There has to be a better way to do this.

Edit vars.yml with the following values:

$ pip2 install passlib
$ python -c "from passlib.hash import sha512_crypt; import getpass; print sha512_crypt.encrypt(getpass.getpass())"
# a prompt will ask you for a password and output a crypted copy
  • timezone: Set the timezone of your system. TODO: Enable auto timezone based on GeoIP.
$ timedatectl list-timezones
# List the correct name of the available timezones
  • hostname: sets the hostname of your device.
  • admin_name: set the name of the primary 'admin' user. This is going to be the first user that gets sudo and manages the system.
  • admin_pass: Set the password of the admin user. This needs to be crypted.
  • admin_keys: a URL to the admins github public keys.

What this playbook does

Ahh.. a sight to be seen

General System Maintenance

# Full update everything \o/
$ pacman -Syu
# listing installed packages
$ pacman -Qqn
# Rebuild ramdisk
$ mkinitcpio -p linux

References:

About

bootstrapping material for raspi

Resources

License

Stars

Watchers

Forks

Packages

No packages published