From 3ba596b4719a6f28f5d5c4f60d3b555b969b3b43 Mon Sep 17 00:00:00 2001 From: Markus Hauschild Date: Wed, 6 Jul 2016 16:28:16 +0200 Subject: [PATCH] Improve librenms role. --- roles/librenms/tasks/main.yml | 19 +++++++++-- roles/librenms/templates/config.php.j2 | 47 ++++++++++++++++++++++++++ roles/librenms/templates/vhost.j2 | 17 ++++++++-- 3 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 roles/librenms/templates/config.php.j2 diff --git a/roles/librenms/tasks/main.yml b/roles/librenms/tasks/main.yml index b867523..934a0c7 100644 --- a/roles/librenms/tasks/main.yml +++ b/roles/librenms/tasks/main.yml @@ -33,8 +33,23 @@ - name: Configure MySQL user mysql_user: name={{ librenms_dbuser }} password={{ librenms_dbpass }} priv={{ librenms_dbname }}.*:ALL state=present -- name: Unpack librenms - unarchive: src=https://github.com/librenms/librenms/archive/201607.zip dest=/opt copy=no + +- name: Ensure librenms user exists + user: name=librenms createhome=no groups=www-data home=/opt/librenms system=yes + +- name: Clone librenms + git: repo=https://github.com/librenms/librenms.git dest=/opt/librenms depth=1 update=no + become: yes + become_user: librenms + +- name: Ensure rrd directory exists + file: path=/opt/librenms/rrd owner=librenms group=librenms mode=0775 state=directory + +- name: Ensure logs directory exists + file: path=/opt/librenms/logs owner=librenms group=librenms mode=0775 state=directory + +- name: Configure librenms + template: src=config.php.j2 dest=/opt/librenms/config.php owner=librenms group=librenms mode=0440 - name: Configure vhost template: src=vhost.j2 dest=/etc/nginx/sites-available/librenms diff --git a/roles/librenms/templates/config.php.j2 b/roles/librenms/templates/config.php.j2 new file mode 100644 index 0000000..3977301 --- /dev/null +++ b/roles/librenms/templates/config.php.j2 @@ -0,0 +1,47 @@ +