# librenms | |||||
# Ansible role to deploy librenms on debian | |||||
ansible role to deploy librenms on debian | |||||
## Requirement | |||||
You need a debian OS (tested on debian 10). You will also need apache installed | |||||
on the same host and a mysql database. | |||||
## Variables (in defaults) | |||||
* **librenms_user** - default value: librenms | |||||
* **librenms_group** - default value: "{{librenms_user}}" | |||||
* **librenms_home** - default value: /opt/librenms | |||||
* **librenms_db_host** - default value: 127.0.0.1:3306 | |||||
* **librenms_db_name** - default value: librenms | |||||
* **librenms_db_user** - default value: librenms | |||||
* **librenms_db_pass** - default value: xai6oa8va7mai7ChaeTu | |||||
* **librenms_fqdn** - default value: localhost | |||||
* **librenms_apache_template** - default value: librenms.conf.j2 | |||||
* **librenms_cert_file** - default value: "/etc/ssl/certs/ssl-cert-snakeoil.pem" | |||||
* **librenms_key_file** - default value: "/etc/ssl/private/ssl-cert-snakeoil.key" | |||||
* **librenms_tls** - default value: yes | |||||
* **librenms_http_port** - default value: 443 | |||||
* **librenms_version** - default value: master | |||||
* **librenms_deb_packages** - list of packages, go check defaults/main.yml | |||||
## Example playbook | |||||
Go an check the playbook directory | |||||
## Role philosophy | |||||
* KISS: Keep it simple Smart-Guy | |||||
* Only support what you need. No magic | |||||
* If you need to fix/troubleshoot or manual install, just go an check the task | |||||
and defaults directories. It should be easy to follow the steps |
--- | |||||
librenms_user: librenms | |||||
librenms_group: "{{librenms_user}}" | |||||
librenms_home: /opt/librenms | |||||
librenms_db_host: 127.0.0.1:3306 | |||||
librenms_db_name: librenms | |||||
librenms_db_user: librenms | |||||
librenms_db_pass: xai6oa8va7mai7ChaeTu | |||||
librenms_fqdn: localhost | |||||
librenms_apache_template: librenms.conf.j2 | |||||
librenms_cert_file: "/etc/ssl/certs/ssl-cert-snakeoil.pem" | |||||
librenms_key_file: "/etc/ssl/private/ssl-cert-snakeoil.key" | |||||
librenms_tls: yes | |||||
librenms_http_port: 443 | |||||
librenms_version: master | |||||
librenms_deb_packages: | |||||
- curl | |||||
- composer | |||||
- fping | |||||
- git | |||||
- graphviz | |||||
- imagemagick | |||||
- libapache2-mod-php7.3 | |||||
- mtr-tiny | |||||
- nmap | |||||
- php7.3-cli | |||||
- php7.3-curl | |||||
- php7.3-gd | |||||
- php7.3-json | |||||
- php7.3-mbstring | |||||
- php7.3-mysql | |||||
- php7.3-snmp | |||||
- php7.3-xml | |||||
- php7.3-zip | |||||
- python-memcache | |||||
- python-mysqldb | |||||
- rrdtool | |||||
- snmp | |||||
- snmpd | |||||
- whois | |||||
- ssl-cert |
--- | |||||
- name: install debian packages | |||||
apt: | |||||
name: "{{librenms_deb_packages}}" | |||||
state: present | |||||
- name: create librenms user | |||||
user: | |||||
name: "{{librenms_user}}" | |||||
comment: "LibreNMS system user" | |||||
shell: /bin/bash | |||||
password_lock: yes | |||||
home: "{{librenms_home}}" | |||||
group: www-data | |||||
system: yes | |||||
- name: clone git repo | |||||
git: | |||||
repo: https://github.com/librenms/librenms.git | |||||
dest: "{{librenms_home}}" | |||||
version: "{{librenms_version}}" | |||||
become: yes | |||||
become_user: "{{librenms_user}}" | |||||
- name: enable apache modules | |||||
apache2_module: | |||||
state: present | |||||
name: "{{item}}" | |||||
loop: | |||||
- rewrite | |||||
notify: | |||||
- restart apache | |||||
- name: deploy apache template | |||||
template: | |||||
src: "{{librenms_apache_template}}" | |||||
dest: /etc/apache2/sites-available/librenms.conf | |||||
notify: | |||||
- restart apache | |||||
- name: enablre librenms site | |||||
file: | |||||
src: /etc/apache2/sites-available/librenms.conf | |||||
dest: /etc/apache2/sites-enabled/librenms.conf | |||||
state: link | |||||
notify: | |||||
- restart apache | |||||
- name: configure snmpd | |||||
debug: msg="TBD" | |||||
- name: configure cron | |||||
debug: msg="TBD" | |||||
- name: configure logrotate | |||||
debug: msg="TBD" |
<VirtualHost *:{{librenms_http_port> | |||||
DocumentRoot "{{librenms_home}}/html/" | |||||
ServerName "{{librenms_fqdn}}" | |||||
{% if librenms_tls %} | |||||
SSLEngine on | |||||
SSLCertificateFile "{{nextcloud_cert_file}}" | |||||
SSLCertificateKeyFile "{{nextcloud_key_file}}" | |||||
{% endif %} | |||||
AllowEncodedSlashes NoDecode | |||||
<Directory "{{librenms_home}}/html/"> | |||||
Require all granted | |||||
AllowOverride All | |||||
Options FollowSymLinks MultiViews | |||||
</Directory> | |||||
</VirtualHost> |