1
0
forked from infra/ansible
infra/roles/librenms/tasks/main.yml

64 lines
1.6 KiB
YAML
Raw Normal View History

2016-07-06 13:26:42 +02:00
---
- 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
2016-07-06 16:28:16 +02:00
- 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
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
- name: Start php5-fpm
service: name=php5-fpm state=started enabled=yes