Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
71 lines (64 sloc) 2.41 KB
# Initial configuration for the Raspberry Pi that handles my home automation
# This playbook just ensures I have my user there, that it is a sudoer and
# that I can ssh with my own key, so I can use it for all other tasks
# in the main playbook (rpi.yml).
# Given it will likely be ran when an image was freshly baked, we also use the
# opportunity to bump all packages to latest in distro, configure my chosen
# hostname/timezone and give it a good reboot, so it's ready to rumble
# To provision from zero:
# - Burn Raspbian (>= Stretch) Lite image to SD with balenaEtecher (or dd)
# - Before putting the SD card on RPi, mount it and:
# - Create empty SSH file (touch /Volumes/boot/SSH)
# - Create wpa_supplicant.conf
# (model here:
# - Unmount, put on RPi and boot it
# - Wait a bit (it will cycle-boot at least once), then run the command
# below (password is raspberry):
# ansible-playbook rpi_provisioning.yml -i hosts -k
# - Supply the default "raspberry" password (for the last time in your life)
# Hints:
# - Ensure your router is redirecting ports 80, 443 and 8123 to
# this RPi's network adaptor, and that it has a fixed IP.
# - mDNS just works: once you reboot, you should be able to
# access your RPi with <host>.local (e.g.: tv-pi.local on mine)
# for ssh, etc.
# - Easy way to make your computer forget about old versions of
# that ip/hostname:
# ssh-keygen -R ip.of.your.pi
# ssh-keygen -R <host>.local
# - My network went bananas when I tried to access my dynamic DNS name,
# but adding an entry pointing it to the internal IP of the RPi
# to /etc/hosts (or better: your router's DNS, if it allwos that)
# fixes it.
- hosts: raspberrypi
remote_user: pi
become: yes
become_method: sudo
admin_user: chesterbr
host: tv-pi
- chesterbr.user_setup
- name: Update all packages to latest within distro, then remove unneeded
- apt: update_cache=yes upgrade=dist
- apt: autoremove=yes
- name: Configure the hostname
- replace:
dest: "/etc/hosts"
regexp: "raspberrypi"
replace: "{{ host }}"
- hostname:
name: "{{ host }}"
- name: Configure timezone
name: America/Toronto
- name: Reboot
You can’t perform that action at this time.