diff --git a/group_vars/FreeBSD b/group_vars/FreeBSD new file mode 100644 index 0000000..649edfe --- /dev/null +++ b/group_vars/FreeBSD @@ -0,0 +1 @@ +pdns_config_dir: /usr/local/etc/pdns diff --git a/group_vars/Ubuntu b/group_vars/Ubuntu new file mode 100644 index 0000000..806c71e --- /dev/null +++ b/group_vars/Ubuntu @@ -0,0 +1 @@ +pdns_config_dir: /etc/powerdns diff --git a/group_vars/all b/group_vars/all index 02b2307..ff9ab00 100644 --- a/group_vars/all +++ b/group_vars/all @@ -14,6 +14,11 @@ ldap_base: dc=binary-kitchen,dc=de ldap_binddn: cn=Services,ou=roles,dc=binary-kitchen,dc=de ldap_bindpw: svcpwd +librenms_domain: librenms.binary.kitchen +librenms_dbname: librenms +librenms_dbuser: librenms +librenms_dbpass: xNUYsUhzwP4u7cVNCECz + mail_domain: binary-kitchen.de mail_domains: - ccc-r.de diff --git a/roles/librenms/handlers/main.yml b/roles/librenms/handlers/main.yml new file mode 100644 index 0000000..44975c4 --- /dev/null +++ b/roles/librenms/handlers/main.yml @@ -0,0 +1,4 @@ +--- + +- name: Restart nginx + service: name=nginx state=restarted diff --git a/roles/librenms/meta/main.yml b/roles/librenms/meta/main.yml new file mode 100644 index 0000000..34de459 --- /dev/null +++ b/roles/librenms/meta/main.yml @@ -0,0 +1,4 @@ +--- + +dependencies: +- { role: nginx, nginx_ssl: False } diff --git a/roles/librenms/tasks/main.yml b/roles/librenms/tasks/main.yml new file mode 100644 index 0000000..b867523 --- /dev/null +++ b/roles/librenms/tasks/main.yml @@ -0,0 +1,48 @@ +--- + +- name: Install dependencies + apt: name={{ item }} state=present + with_items: + - fping + - git + - graphviz + - imagemagick + - mtr-tiny + - mysql-server + - nmap + - php-net-ipv4 + - php-net-ipv6 + - php-pear + - php5-cli + - php5-curl + - php5-fpm + - php5-gd + - php5-json + - php5-mcrypt + - php5-mysql + - php5-snmp + - python-mysqldb + - rrdtool + - snmp + - snmpd + - whois + +- name: Configure MySQL database + mysql_db: name={{ librenms_dbname }} + +- 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: Configure vhost + template: src=vhost.j2 dest=/etc/nginx/sites-available/librenms + notify: Restart nginx + +- name: Enable vhost + file: src=/etc/nginx/sites-available/librenms dest=/etc/nginx/sites-enabled/librenms state=link + notify: Restart nginx + +- name: Start php5-fpm + service: name=php5-fpm state=started enabled=yes diff --git a/roles/librenms/templates/vhost.j2 b/roles/librenms/templates/vhost.j2 new file mode 100644 index 0000000..978942e --- /dev/null +++ b/roles/librenms/templates/vhost.j2 @@ -0,0 +1,19 @@ +server { + listen 80; + listen [::]:80; + + server_name {{ librenms_domain }}; + + root /opt/librenms/wwwroot; + + index index.php; + + location ~ \.php(?:$|/) { + fastcgi_split_path_info ^(.+\.php)(/.+)$; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_pass unix:/var/run/php5-fpm.sock; + fastcgi_intercept_errors on; + } +}