24 September 2015

facts2dw.rb is a simple script which converts ansible(tested with1.9.2) facts into dokuwiki-format and uploads it via xmlrpc-interface into dokuwiki This script uses http-basic-authentication and ssl to login into dokuwiki. Ansible caches all the facts in <ANSIBLE-DIR>/facts so it is quite easy to import all facts into dokuwiki using the following line:

for i in `ls *`; do facts2dw.rb $i; done

To upload all the changes whenever they occur I would suggest to use inotify. It is very easy to change this script to use puppet-facts instead of ansible-facts. If puppetdb is installed all the facts can fetched via the rest interface. It’s just a matter of few lines. Of course the jason-structur will look different, but it will be easy to modify this very simple script. I would recommend to use the debug-code which executes ‘pp’, to dump the jason-hash.

BTW: don’t forget to configure the xmlrpc-access in dokuwiki proberly!

[ Programming  Sysadmin  Puppet  Ruby  Downloads  Ansible  ]
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution 3.0 Unported License.

Copyright 2015-present Hoti