ansible.arpwatch/tasks/main.yml

39 lines
1.2 KiB
YAML

---
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
#
# tasks file for ipr-cnrs.arpwatch
# Manage required system packages [[[1
- name: Ensure required packages are in there desired state
ansible.builtin.package:
name: '{{ arpwatch__base_packages | flatten }}'
state: 'present'
install_recommends: False
register: pkg_result
until: pkg_result is success
when: arpwatch__enabled|bool
# Manage service default [[[1
- name: Manage service default
ansible.builtin.template:
src: 'etc/default/arpwatch.j2'
dest: "/etc/default/arpwatch"
owner: root
group: root
mode: '0644'
when: ((arpwatch__enabled | bool) and
(arpwatch__service_manage | bool))
notify: ['restart arpwatch service']
# Manage service [[[1
- name: Manage arpwatch service by network interface
ansible.builtin.service:
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 }}'