2018-04-23 09:21:32 +02:00
|
|
|
---
|
|
|
|
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
|
|
|
|
#
|
|
|
|
# tasks file for ipr-cnrs.arpwatch
|
|
|
|
|
|
|
|
# Manage required system packages [[[1
|
|
|
|
- name: Ensure required packages are in there desired state
|
|
|
|
package:
|
|
|
|
name: '{{ item }}'
|
|
|
|
state: 'present'
|
|
|
|
install_recommends: False
|
|
|
|
with_flattened:
|
2019-02-27 11:53:40 +01:00
|
|
|
- '{{ arpwatch__base_packages | to_nice_json }}'
|
2019-02-27 12:01:14 +01:00
|
|
|
register: pkg_result
|
|
|
|
until: pkg_result is success
|
2018-04-23 09:21:32 +02:00
|
|
|
when: arpwatch__enabled|bool
|
|
|
|
|
2020-04-28 08:43:12 +02:00
|
|
|
# Manage service default [[[1
|
2018-04-23 11:55:25 +02:00
|
|
|
- name: Manage service default
|
|
|
|
template:
|
2019-02-27 12:05:35 +01:00
|
|
|
src: 'etc/default/arpwatch.j2'
|
2018-04-23 11:55:25 +02:00
|
|
|
dest: "/etc/default/arpwatch"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: '0644'
|
2019-02-27 12:08:44 +01:00
|
|
|
when: ((arpwatch__enabled | bool) and
|
|
|
|
(arpwatch__service_manage | bool))
|
2018-04-23 11:55:25 +02:00
|
|
|
notify: ['restart arpwatch service']
|
2018-04-23 09:21:32 +02:00
|
|
|
|
|
|
|
# Manage service [[[1
|
2020-04-27 20:36:21 +02:00
|
|
|
- name: Manage arpwatch service by network interface
|
2018-04-23 09:21:32 +02:00
|
|
|
service:
|
2020-04-27 20:36:21 +02:00
|
|
|
name: '{{ arpwatch__service_name }}@{{ item }}'
|
2018-04-23 09:21:32 +02:00
|
|
|
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)) }}'
|
2020-04-27 20:36:21 +02:00
|
|
|
with_items:
|
|
|
|
- '{{ arpwatch__conf_interfaces }}'
|