- 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 }}"