HowTo: Ansible roles - HolgerHees/smartserver GitHub Wiki

How to add a custom ansible role

First, a general documentation about ansible is availible at docs.ansible.com

A good starting point to see how custom ansible roles are used is the apache_proxy example role.

This role registers some apache proxy configurations to make external devices, like cameras, available behind a url path. Additionally it registers several menu entries for each device in the main WebUI.

But now, lets check which files are relevant for this custom role.

File Example Description
tasks/mail.yml example Main ansible role which defines the tasks needed to install this feature.
templates Folder which contains all additional files like images, configs etc. They are referenced/copied by the ansible tasks defined in the main.yml file.
templates/etc/apache2/_.ansible.conf.d/proxy.conf example Apache config with proxy definitions.
templates/webui/proxy.js example Javascript file which creates the menu entries. To know more about it, check How to register a menu entry in the webui
templates/webui/proxy.de.json example Translations which are used for the menu entries

Finally, the role must be included in the file config/myserver/roles.yml example (last line).