OpenHAB2 - automated installation


I always set up my systems using ansible do get reproducable results. So I want to try this for openhab 2 as well. Setup of environment, apt repository, apt-ijnstall and such are no problem.
But how could I automate the process of installing plugins or features? I know the ssh management console but because that’s not a normal shell it’s quite complicated. Is there another option to check if a feature is installed or to install one?
Optimal would be a command line option (like eclipse’s P2 director).

Kind regards,


You can look at my Ansible-scripts for configuration of OpenHAB2.
After apt-get install the configuration will be located at /etc/openhab2 (on linux that is)

It says it’s for a RPI, but it works nicely on my Ubuntu-server as well

Thank you,
it looks what I’m looking for: install_openhab_component.yml
I’ll check it and tell you if it works for me.


I found a nice solution to install the extensions that are available via PaperUI: the REST-Service. This can easily be controlled via ansible:

  - name: Get list of available and installed extensions
    uri: url=
    register: oh2_extenstions
  - name: Install extensions
    uri: url={{ item }}/install
    when: "{{ not (oh2_extenstions.json|byattr('id',item))[0].installed }}"
    - binding-mqtt

The byattr filter is not default but easily to add to your playbook folder. See for details.
The nice thing is that I can get a list of installed extensions without knowing the installed version.

I would put all your add-ons and settings into addons.cfg and runtime.cfg, check in your /etc/openhab2 folder into a personal git server or the like and use ansible to check it out onto your OH server, or at a minimum copy the files over.

You will have to do this anyway for your Items, Rules, et al.

The current advantage of using addons.cfg is that you don’t have to go and reinstall all the add-ons after an upgrade of OH 2. That won’t need to be done forever but for now it is a problem.

Could it be possible, that this does not work work for the addons tagged “install manual” in the documentation?
I tried to install the IEC 62056-21 meter binding this way by adding iec6205621meter1 to binding list, but in contrast to other bindings (oh1 and oh2 bindings) this one is ignored.

But in the paperUI I see the binding and should be able to install it (but that’s not what what I want, since installation should be automated using SaltStack).

I do not know but that would make sense.

You can try to install it using the REST API or through an ssh to the karaf console to automate the install.