Skip to content
Ansible role for configuring a headless Raspberry Pi server.
Branch: master
Clone or download

Latest commit


Type Name Latest commit message Commit time
Failed to load latest commit information.
defaults correct my PR Feb 27, 2019
handlers Fixed linter issues. Apr 4, 2020
library Fixed expand FS check to be more resilient. Apr 4, 2020
meta Fixed linter issues. Apr 4, 2020
tasks Fixed linter issues. Apr 4, 2020
vars Fixed linter issues. Apr 4, 2020
.gitignore First presentable version Apr 5, 2015 Updated README due to Galaxy new name convention tyranny. Sep 24, 2018


Ansible Role Ansible Role

A configuration role for Raspbian-based Raspberry Pi machines. Provides the following features:

  • exposes and/or emulates those raspi-config options that are most relevant to headless servers (see Rule Variables),
  • allows to add user-specified settings to /boot/config.txt via the raspi_config_other_options variable,
  • warns about leaving the default credentials accessible.


None, other than installing the role itself. To do that, create a requirements.yml file next to your playbook with the following contents:

- name: mikolak-net.raspi_config

(note the _ underscore instead of the - hyphen in raspi_config)

and then run:

ansible-galaxy install -r requirements.yml

The role and its dependencies should be now installed and ready to reference in your playbook via the name given in the requirements file.

Note: you can also install the role directly:

ansible-galaxy install mikolak-net.raspi_config

but creating a requirements file is just good practice.

Role Variables

All user variables reside in defaults/main.yml. Currently the following are available:

# perform full update+upgrade
raspi_config_update_packages: yes
# have the FS fill the SD card
raspi_config_expanded_filesystem: yes
# how much memory should be owned by the GPU (vs RAM)
raspi_config_memory_split_gpu: 16
#currently sets Pi2 OC setting if applicable
raspi_config_ensure_optimal_cpu_params: yes
# set global locale
raspi_config_locale: en_US.UTF-8
# set timezone
raspi_config_timezone: UTC
# list of services that should be restarted if the timezone is changed
raspi_config_timezone_dependent_services: []
# set hostname
raspi_config_hostname: pi
# ensure camera support is on - CURRENTLY UNVERIFIED
raspi_config_enable_camera: no
# specify whether to fail deployment when user/password is default
# ignored if "raspi_config_replace_user" is set (warning will still display)
raspi_config_fail_on_auth_test: yes
# user to replace the default "pi" user with
# NOTE: if you use this for the first time as "pi", any post_tasks will fail!
  path_to_ssh_key: #LOCAL path to your public key file
# wait this many seconds before forcing connection retry after reboot
raspi_config_reboot_max_wait_time: 300
# use this to add any additional options to the config in raw form
raspi_config_other_options: {}


See dependencies in meta/main.yml.

Example Playbook

- hosts: pi*
  remote_user: pi
  become: true
     - role: mikolak-net.raspi_config
         name: mainuser
         path_to_ssh_key: "~/.ssh/"



Author Information

Issues should be reported on the project page.

Thanks to:

You can’t perform that action at this time.