mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 11:42:08 +00:00
43 lines
1.1 KiB
YAML
43 lines
1.1 KiB
YAML
- name: Install vnstat package
|
|
package:
|
|
name: vnstat
|
|
state: present
|
|
tags:
|
|
- download
|
|
|
|
- name: Install /etc/vnstat.conf from template
|
|
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: Enable & Start vnStat's systemd service
|
|
systemd:
|
|
name: vnstat
|
|
enabled: yes
|
|
state: started
|
|
|
|
- name: Add 'vnstat' variable values to {{ iiab_ini_file }}
|
|
ini_file:
|
|
path: "{{ 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 }}"
|