mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 19:52:06 +00:00
46 lines
1.2 KiB
YAML
46 lines
1.2 KiB
YAML
---
|
|
- name: Install required packages
|
|
package:
|
|
name: "{{ item }}"
|
|
state: present
|
|
with_items:
|
|
- vnstat
|
|
tags:
|
|
- download
|
|
|
|
- name: Put the config file in place
|
|
template:
|
|
src: vnstat.conf.j2
|
|
dest: /etc/vnstat.conf
|
|
mode: 0744
|
|
owner: root
|
|
group: root
|
|
|
|
- name: Create database for WAN to collect vnStat data
|
|
shell: /usr/bin/vnstat -i {{ iiab_wan_iface }}
|
|
|
|
- name: Create database for LAN to collect vnStat data if not appliance config
|
|
shell: /usr/bin/vnstat -i {{ iiab_lan_iface }}
|
|
when: iiab_lan_iface is defined
|
|
|
|
- name: Start vnStat daemon via systemd
|
|
service:
|
|
name: vnstat
|
|
enabled: yes
|
|
state: started
|
|
|
|
- name: Add 'vnstat' to list of services at {{ iiab_ini_file }}
|
|
ini_file:
|
|
dest: "{{ iiab_ini_file }}"
|
|
section: vnstat
|
|
option: "{{ item.option }}"
|
|
value: "{{ item.value }}"
|
|
with_items:
|
|
- option: name
|
|
value: vnStat
|
|
- option: description
|
|
value: '"vnStat is a console-based network traffic monitor for Linux and BSD that keeps a log of network traffic for the selected interface(s)."'
|
|
- option: installed
|
|
value: "{{ vnstat_install }}"
|
|
- option: enabled
|
|
value: "{{ vnstat_enabled }}"
|