# Ansible

This guide will show you how to manage multiple instances of room-assistant around your house easily. This is especially interesting as it allows you to define common configuration and update all instances at once. Additionally, it takes care of running all the installation steps for you.

# Requirements

# Steps

  1. Setup your Linux boards (e.g. Pi 3, 4 or Zero W) to the point where you can access them over the network with SSH. If you want a quick reference on how to do this for Raspberry devices you can take a look at the first section of their respective quickstart guides in the documentation.

  2. Clone the repository containing the room-assistant playbook: git clone https://github.com/mKeRix/ansible-playbooks.git

  3. Switch to the folder that you just cloned and run ansible-galaxy install -r requirements.yml to download the dependencies.

  4. Create a file hosts.yml in the cloned folder. It should contain a list of network addresses for your devices under all (e.g. bedroom.local or and your room-assistant configuration. You can find a more detailed reference of the available options in the repository README (opens new window) and the Ansible documentation (opens new window). Below is an example that configures a generic room_assistant_global_config, which is partially overridden for the living-room.local node.

                - homeAssistant
                - bluetoothClassic
                - omronD6t
                - gpio
                - name: Motion Sensor
                  pin: 17
                  deviceClass: motion
        room_assistant_version: latest
              - homeAssistant
              - bluetoothClassic
            mqttUrl: mqtt://homeassistant.local:1883
              username: room-assistant
              password: secretpass
              - 'xx:xx:xx:xx:xx:xx'
  5. Execute the playbook with ansible-playbook -i hosts.yml -u pi room-assistant.yml to install the required dependencies and room-assistant as a service on all of the hosts in your inventory file. Note that some tasks will take a while on the first run, for example the "Install room-assistant" step. Be patient and let it finish.

  6. Congratulations, you have installed room-assistant across a cluster of devices and can manage it from a central point now! 🎉 Whenever you want to change something you can simply edit your hosts.yml file as needed, for example by changing room_assistant_version to update. Then re-run ansible-playbook -i hosts.yml -u pi room-assistant.yml to apply your changes.