How to create a perl web service infrastructure

I have many scenarios that I use to manage the infrastructure of several servers. Some of these scenarios require root access, some require database access, and most of them are based on perl. I would like to convert all these scripts into very simple web services that can be executed from different applications. These web services will accept regular requests and will output json as a result of execution. I think I should set up a simple perl manager, name it action, which will do the logging, credential checking, and the execution of these simple scripts. Sort of:

http://host/action/update-dns?server=www.google.com&ip=192.168.1.1

This will invoke the actionperl driver , which in turn will invoke the update-dnsscript with the appropriate parameters (possibly cleaned up in some way) and return the corresponding json response. I would like this infrastructure to have the following attributes:

  • All scripts are in one place. If a new script falls there, it will automatically become callable.
  • All scripts should have some form of manifest that describes who can name it (belonging to some ldap group), what parameters are required, what is the answer, etc. So this is self-explanatory.
  • All scenarios are recorded in terms of who did what and how the answer was.
  • It would be great if there was a command line way to do something like # action update-dns --server=www.google.com --up=192.168.1.1

Should I get it from scratch or is there something already that I can play on?

+3

All Articles