aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--raspbian-template.yml11
-rw-r--r--roles/raspbian-template/README.md55
-rw-r--r--roles/raspbian-template/files/eth0.network6
-rw-r--r--roles/raspbian-template/meta/main.yml6
-rw-r--r--roles/raspbian-template/tasks/main.yml12
-rw-r--r--roles/raspbian-template/vars/main.yml12
6 files changed, 102 insertions, 0 deletions
diff --git a/raspbian-template.yml b/raspbian-template.yml
new file mode 100644
index 0000000..42040c4
--- /dev/null
+++ b/raspbian-template.yml
@@ -0,0 +1,11 @@
+---
+- hosts: raspbian-template
+ pre_tasks:
+ - name: Detect chroot
+ set_fact:
+ chroot: "{{ ansible_connection == 'chroot' or 'container' in ansible_env }}"
+ tags: always
+ roles:
+ - raspbian-template
+
+# vim: set ts=2 sw=2 et:
diff --git a/roles/raspbian-template/README.md b/roles/raspbian-template/README.md
new file mode 100644
index 0000000..7a91651
--- /dev/null
+++ b/roles/raspbian-template/README.md
@@ -0,0 +1,55 @@
+raspbian-template
+=================
+
+About
+-----
+
+This is a template for an ansible role setting up a
+[Raspberry Pi][rpi] running [Raspbian][raspbian].
+
+[rpi]: https://www.raspberrypi.org
+[raspbian]: https://www.raspbian.org
+
+Bootstrap a new Raspberry Pi
+----------------------------
+
+Download a "Lite" image from the Raspberry Pi [homepage][downloads],
+and write it to your sd-card as described on that page.
+
+Before removing the sd-card from your computer make sure to mount
+the vfat filesystem on the first partition and create an (empty)
+file called "ssh". This enables an [SSH][ssh] daemon on boot so
+you and Ansible can log into it on boot.
+
+Now move your sd-card to the Raspberry Pi, connect an ethernet cable
+and lastly the power.
+Once you figure out the ip address of the Raspberry Pi you can run
+the following command to bootstrap it:
+
+```sh
+ansible-playbook -D \
+ -i raspbian-template, \
+ -e ansible_host=<ip address> \
+ -e ansible_ssh_user=pi \
+ -e ansible_ssh_pass=raspberry \
+ raspbian-template.yml
+```
+
+Now go buy a Mate or something. This will take a long time..
+
+Once it finishes you should have a fully upgraded Raspbian
+with all the Labitat users and their ssh keys in place.
+Hence you should now be able run ansible with your own
+ssh user. Eg. just
+
+```sh
+ansible-playbook -D \
+ -i raspbian-template, \
+ -e ansible_host=<ip address> \
+ raspbian-template.yml
+```
+
+Now is a good time to ssh into it and reboot it,
+so it uses the new network setup after boot.
+
+[ssh]: https://en.wikipedia.org/wiki/Secure_Shell
diff --git a/roles/raspbian-template/files/eth0.network b/roles/raspbian-template/files/eth0.network
new file mode 100644
index 0000000..3e351ea
--- /dev/null
+++ b/roles/raspbian-template/files/eth0.network
@@ -0,0 +1,6 @@
+[Match]
+Name=eth0
+
+[Network]
+DHCP=yes
+IPv6AcceptRA=yes
diff --git a/roles/raspbian-template/meta/main.yml b/roles/raspbian-template/meta/main.yml
new file mode 100644
index 0000000..731a8f2
--- /dev/null
+++ b/roles/raspbian-template/meta/main.yml
@@ -0,0 +1,6 @@
+---
+dependencies:
+- role: raspbian
+- role: users
+
+# vim: set ts=2 sw=2 et:
diff --git a/roles/raspbian-template/tasks/main.yml b/roles/raspbian-template/tasks/main.yml
new file mode 100644
index 0000000..31f91f5
--- /dev/null
+++ b/roles/raspbian-template/tasks/main.yml
@@ -0,0 +1,12 @@
+---
+- name: Install network configuration
+ copy:
+ dest: '/etc/systemd/network/10-eth0.network'
+ src: eth0.network
+ owner: root
+ group: root
+ mode: 0644
+ tags:
+ - networkd-config
+
+# vim: set ts=2 sw=2 et:
diff --git a/roles/raspbian-template/vars/main.yml b/roles/raspbian-template/vars/main.yml
new file mode 100644
index 0000000..21e034c
--- /dev/null
+++ b/roles/raspbian-template/vars/main.yml
@@ -0,0 +1,12 @@
+---
+hostname: 'raspbian-template'
+
+apt_sources:
+ raspbian:
+ components:
+ - main
+ - contrib
+ - no-free
+ - rpi
+
+# vim: set ts=2 sw=2 et: