Ansible playbooks and roles to deploy and configure Mycroft

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 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. :partying_face:

What does Ansible prepi role?

README: GitHub - smartgic/ansible-role-prepi: Configuration and optimization to improve Raspberry Pi 4 board performances.

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 next branch which provide kernel 5.10 (customizable)
  • Update EEPROM using the beta version (customizable)
  • Setup initial_turbo to speedup the boot process
  • Overclock the Raspberry Pi to 2Ghz (customizable)
  • Mount /tmp on 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 performance to avoid context switching between the idle* kernel functions (customizable)
  • Install and configure PulseAudio (non-system wide) (customizable)

What does Ansible mycroft role?

README: GitHub - smartgic/ansible-role-mycroft: This Ansible role will install and configure Mycroft from GitHub repository.

The role will perform the following tasks:

  • Install and configure Mycroft AI Voice Assistant
  • Myroft services integrated with systemd
  • Extra skills installation
  • boto3, py_mplayer and pyopenssl Python librairies installation
  • RAMDisk support for IPC
  • Configure Mycroft with custom user profile
  • Optimize PulseAudio for Mycroft
  • Protect Mycroft message bus service port 8181


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
$ 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.



Based on @ChanceNCounter first feedback I added a task to mycroft role that blocks port 8181 using IPTables by default, only localhost will be able to communicate on this port.

This is a customizable choice, user can disable this firewall rule.

1 Like

Still based on @ChanceNCounter feedback and HiveMind setup, the websocket has been secured using the SSL option by default and address binding when required.

1 Like

Due to recent issues that I had with the default audio backend, I decided to add VLC backend support to the role and to make it the default one.

1 Like