I have built raspberry pi with Piface to control my physical pcs, I have server with Ubuntu 16.04 and installed MAAS 2.1.5 on it.
There was old post, how to build pc power control using ubuntu 14.x and MAAS 1.5.x
Link to post: PC Power Control with a Raspberry Pi and MAAS
Author of post is adding custom power source that is Raspberry PI interface with connected relay.
Author adds custom template "/etc/maas/templates/power/pipower.template" into directory "/etc/maas/templates/power/" but MAAS 2.1.x that I have, does not contain any directories like that in /etc/maas/
Second thing: Authors says to edit python file
Add an entry to JSON_POWER_TYPE_PARAMETERS in /usr/lib/python2.7/dist-packages/provisioningserver/power_schema.py
But MAAS 2.1.x does not uses "provisioningserver" plugin, it is deprecated now, and also looks like MAAS 2.1.x uses python 3
Code, that should be placed in that file:
{
'name': 'pipower',
'description': 'Pipower',
'fields': [
make_json_field('node_name', "Node Name"),
make_json_field('power_address', "Power Address"),
make_json_field('state_pin', "Power State Pin Number"),
make_json_field('reset_relay', "Reset Relay Number"),
make_json_field('power_relay', "Power Relay Number"),
],
}
And third thing that author does is:
Tell maas that this powertype supports querying powerstate (unlike wake-on-lan). Edit /usr/lib/python2.7/dist-packages/provisioningserver/rpc/power.py and add ‘pipower’ to QUERY_POWER_TYPES
This also can't be completed on MAAS 2.1.x as it does not contains that file. "power.py"
Question is. How can I port this guide to work on MAAS 2.1.5 and Ubuntu 16.04 LTS.
I need to add custom power source and provision servers using raspberry pi.
Thanks.
Update 1
I have tried to get help in the irc freenode server, in #maas channel, and I have been pointed to this link: https://stgraber.org/2017/04/02/using-wake-on-lan-with-maas-2-x/
Looks like only way to do this in maas 2.1 is to modify source code of maas, and it is difficult way to implement. My python skills won't let me to complete this task.