2016-07-06 13:26:42 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Install dependencies
|
2017-07-02 22:17:32 +02:00
|
|
|
apt: name={{ item }}
|
2016-07-06 13:26:42 +02:00
|
|
|
with_items:
|
|
|
|
- fping
|
|
|
|
- git
|
|
|
|
- graphviz
|
|
|
|
- imagemagick
|
|
|
|
- mtr-tiny
|
2019-09-09 19:33:47 +02:00
|
|
|
- mariadb-server
|
2016-07-06 13:26:42 +02:00
|
|
|
- nmap
|
|
|
|
- php-net-ipv4
|
|
|
|
- php-net-ipv6
|
|
|
|
- php-pear
|
2019-09-09 19:33:47 +02:00
|
|
|
- php7.3-cli
|
|
|
|
- php7.3-curl
|
|
|
|
- php7.3-fpm
|
|
|
|
- php7.3-gd
|
|
|
|
- php7.3-json
|
|
|
|
- php7.3-mbstring
|
|
|
|
- php7.3-mysql
|
|
|
|
- php7.3-snmp
|
2016-07-06 13:26:42 +02:00
|
|
|
- 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
|
|
|
|
|
2016-07-06 16:28:16 +02:00
|
|
|
- name: Ensure librenms user exists
|
2016-07-07 07:03:53 +02:00
|
|
|
user: name=librenms groups=www-data createhome=no home=/usr/share/librenms system=yes
|
2016-07-06 16:28:16 +02:00
|
|
|
|
|
|
|
- name: Clone librenms
|
2016-07-07 07:03:53 +02:00
|
|
|
git: repo=https://github.com/librenms/librenms.git dest=/usr/share/librenms depth=1 update=no
|
2016-07-06 16:28:16 +02:00
|
|
|
|
|
|
|
- name: Configure librenms
|
2016-07-07 07:03:53 +02:00
|
|
|
template: src=config.php.j2 dest=/usr/share/librenms/config.php owner=librenms group=www-data mode=0440
|
2016-07-06 13:26:42 +02:00
|
|
|
|
2019-09-09 19:33:47 +02:00
|
|
|
- name: Set php timezone
|
|
|
|
lineinfile:
|
|
|
|
path: "{{ item }}"
|
|
|
|
regexp: ';?date\.timezone'
|
|
|
|
line: 'date.timezone = Europe/Berlin'
|
|
|
|
with_items:
|
|
|
|
- /etc/php/7.3/cli/php.ini
|
|
|
|
- /etc/php/7.3/fpm/php.ini
|
|
|
|
|
2019-02-13 15:57:46 +01:00
|
|
|
- name: Ensure certificates are available
|
|
|
|
command: openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/nginx/ssl/{{ librenms_domain }}.key -out /etc/nginx/ssl/{{ librenms_domain }}.crt -days 730 -subj "/CN={{ librenms_domain }}" creates=/etc/nginx/ssl/{{ librenms_domain }}.crt
|
|
|
|
notify: Restart nginx
|
|
|
|
|
|
|
|
- name: Request nsupdate key for certificate
|
|
|
|
include_role: name=acme-dnskey-generate
|
|
|
|
vars:
|
|
|
|
acme_dnskey_san_domains:
|
|
|
|
- "{{ librenms_domain }}"
|
|
|
|
|
|
|
|
- name: Configure certificate manager for librenms
|
2019-05-20 19:49:08 +02:00
|
|
|
template: src=certs.j2 dest=/etc/acertmgr/{{ librenms_domain }}.conf
|
2019-02-23 23:54:24 +01:00
|
|
|
notify: Run acertmgr
|
2019-02-13 15:57:46 +01:00
|
|
|
|
2016-07-06 13:26:42 +02:00
|
|
|
- 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
|
|
|
|
|
2019-09-09 19:33:47 +02:00
|
|
|
- name: Start php7.3-fpm
|
|
|
|
service: name=php7.3-fpm state=started enabled=yes
|