Hi community,
I spent the last few days working on some Ansible playbooks and roles to prepare the Raspberry Pi 4 board and to install, configure and optimize Mycroft on top of it.
Basically the Ansible playbooks consists of the usage of two Ansible roles which are prepi and mycroft and could be run at scale to provision hundreds of Raspberry Pi & Mycroft at the same time.
Raspberry Pi OS and Debian Buster are the only distributions supported so far.
The installation process of Mycroft is inspired by the dev_setup.sh script provided with the Mycroft AI Core. This playbook is not better than the script provided by the core team, it’s just a different approach.
This is not perfect and some people will certainly complain about the fact that there are firmware & EEPROM update and overclocking but all of this could be customized/disabled.
Fill free to share your feedback and to contribute. 
What does Ansible prepi role?
README: https://github.com/smartgic/ansible-role-prepi
Using the prepi Ansible role will ensure your Raspberry Pi to be properly configured for the best of Mycroft experience.
The role will perform the following tasks (depending your wish):
- Update Raspberry Pi OS to the latest version
- Add Debian backports repository (customizable)
- Update firmware using the
nextbranch which provide kernel 5.10 (customizable) - Update EEPROM using the
betaversion (customizable) - Setup
initial_turboto speedup the boot process - Overclock the Raspberry Pi to 2Ghz (customizable)
- Mount
/tmpon a RAMDisk for Mycroft TTS cache files - Optimize
/partition mount options to improve SDcard read/write - Enable I2C, SPI & UART interfaces (customizable)
- Set CPU governor to
performanceto avoid context switching between theidle*kernel functions (customizable) - Install and configure PulseAudio (non-system wide) (customizable)
What does Ansible mycroft role?
README: https://github.com/smartgic/ansible-role-mycroft
The role will perform the following tasks:
- Install and configure Mycroft AI Voice Assistant
- Myroft services integrated with systemd
- Extra skills installation
-
boto3,py_mplayerandpyopensslPython librairies installation - RAMDisk support for IPC
- Configure Mycroft with custom user profile
- Optimize PulseAudio for Mycroft
- Protect Mycroft message bus service port
8181
Requirements
- Raspberry Pi 4B board and later connected to your network
- Raspberry Pi OS 64-bit (required for board with more than 4GB of RAM)
- Ansible 2.9 minimum (follow this guide)
- SSH up and running (howto enable SSH on Raspberry Pi)
How to use it?
Fulfill the requirements from just above, update the inventory file with your IP address/user and then run the following commands:
$ git clone https://github.com/smartgic/ansible-playbooks-mycroft
$ cd ansible-playbook-mycroft
$ ansible-galaxy install -r requirements.yml
$ ansible-playbook -i inventory install-interactive.yml
Then answer the questions:
I hope this Ansible playbooks/roles will be useful to someone else than me.
Links
