Prepare Rapsberry Pi 4 running Debian 11 for Home Assistant Supervised installation.
This role is intended to run on Raspberry Pi 4 running Debian 11 installed using steps 1.1-1.3 of the Installing Home Assistant Supervised on a Raspberry Pi with Debian 11 community guide.
Since Ansible requires SSH to manage machines remotely, it is recommended to activate the root login by editing the sysconfig.txt file and uncomment the root password and the root_authorized_key. Then you should generate an SSH key pair and use the generated public key to paste there.
This role generates SSH keys on the control node for the currently logged in user to remotely manage the Raspberry Pi, so you should run this role from the machine you want to use to for remote management
The following software is required on the control node:
- ssh-keygen
The following facts are used by this role
ansible_default_ipv4['address']: Use to configure static IP in /etc/hosts when `has_reserved_ip == true`
Variables in defaults/main.yml
with default values
# non-root user to create on the Home Assistant server
home_assistant_user: homeassistant
# Set this to true if you have a static IP for the Raspberry Pi
# When set to true, set the ipv4 address in /etc/hosts
# When set to false, 127.0.1.1 will be set in /etc/hosts
has_reserved_ip: false
# Use this option when you want full control over creating SSH keys and
# configuring them for uses with Ansible.
# When set to true, the role will not attempt to create SSH keys
# or add existing keys to home_assistant_user's authorized keys.
preinstall_config_leave_my_keys_alone: false
# The name of the SSH key file. If you already have an existing key
# named id_rsa and want to use a different key for using Ansible with Home Assistant,
# you can specify an alternate key file name and then use `ansible_ssh_private_key_file`
# host var, the `-k` ansible cli command line flag, or any other valid method to specify
# a non-default ssh key file
preinstall_config_ssk_key_name: id_rsa
None
# Run the playbook from remote control node to Rapsberry Pi
# and override the default name of the non-root account to create
- hosts: pi
become: yes
tasks:
- name: Prepare Pi for Home Assistant Supervised installation
import_role:
name: jhampson_dbre.home_assistant.preinstall_config
vars:
home_assistant_user: james
MIT
@jhampson-dbre