From f06e7c355c3cd6fa9abf2ece4fb1ded81902dab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Mon, 27 Apr 2020 20:36:21 +0200 Subject: [PATCH] Adapt for Buster start with arpwatch v2.1a15-7 --- CHANGELOG.md | 6 ++++++ README.md | 3 ++- defaults/main.yml | 7 +++++++ handlers/main.yml | 4 +++- tasks/main.yml | 6 ++++-- 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a84fc0e..632d99d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v2.X.Y + +### Features + +* Adapt for Debian Buster (start with arpwatch version 2.1a15-7) + ## v1.0.2 ### Fix diff --git a/README.md b/README.md index 2fb0389..897fe9e 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Manage Arpwatch installation and configuration. * **arpwatch__enabled** : Enable or disable support for Arpwatch on a given host [default : `True`]. * **arpwatch__service_manage** : If the arpwatch service should be managed [default : `True`]. * **arpwatch__service_name** : The service name to manage [default : `arpwatch`]. +* **arpwatch__conf_interfaces** : List of network interfaces where arpwatch should listen [default : `[ '{{ ansible_default_ipv4.interface }}' ]`]. * **arpwatch__conf_src** : Template used to provide configuration file [default : `../templates/etc/arpwatch.conf.j2`]. * **arpwatch__conf_username** : Username that should run Arpwatch [default : `arpwatch`]. * **arpwatch__conf_args** : Arguments to apply to Arpwatch [default : `-N -p`]. @@ -39,7 +40,7 @@ This role will : * Manage `arpwatch` configuration (/etc/arpwatch.conf). * Allow to set the user that run Arpwatch. * Allow to set arguments to pass Arpwatch service. -* Ensure `arpwatch` service is enabled and started. +* Ensure to start an `arpwatch` process for the main network interface at least. * Ensure to restart `arpwatch` service if configuration changed. ## Development diff --git a/defaults/main.yml b/defaults/main.yml index 15166d4..8cd5f6b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -46,6 +46,13 @@ arpwatch__service_manage: True # Configuration [[[ # ----------------------------- +# .. envvar:: arpwatch__conf_interfaces [[[. +# List of network interfaces that should have a running arpwatch process. +# +# By default, only listen on the main network interface. +arpwatch__conf_interfaces: [ '{{ ansible_default_ipv4.interface }}' ] + + # ]]] # .. envvar:: arpwatch__conf_src [[[. # Template used to provide configuration file. # diff --git a/handlers/main.yml b/handlers/main.yml index 163d6e3..78d3935 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -2,8 +2,10 @@ # handlers file for arpwatch - name: restart arpwatch service service: - name: '{{ arpwatch__service_name }}' + name: '{{ arpwatch__service_name }}@{{ item }}' state: '{{ "restarted" if (arpwatch__enabled | d(True) | bool and (arpwatch__service_manage | d(True) | bool)) else "stopped" }}' enabled: '{{ arpwatch__service_manage | d(True) | bool }}' + with_items: + - '{{ arpwatch__conf_interfaces }}' diff --git a/tasks/main.yml b/tasks/main.yml index e739a47..561c764 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -41,11 +41,13 @@ # ]]] # Manage service [[[1 -- name: Manage arpwatch service +- name: Manage arpwatch service by network interface service: - name: '{{ arpwatch__service_name }}' + name: '{{ arpwatch__service_name }}@{{ item }}' state: '{{ "started" if ((arpwatch__enabled | d(True) | bool) and (arpwatch__service_manage | d(True) | bool)) else "stopped" }}' enabled: '{{ ((arpwatch__enabled | d(True) | bool) and (arpwatch__service_manage | d(True) | bool)) }}' + with_items: + - '{{ arpwatch__conf_interfaces }}'