ansible.arpwatch/tasks/main.yml

52 lines
1.6 KiB
YAML
Raw Normal View History

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:
- '{{ arpwatch__base_packages | to_nice_json }}'
register: pkg_result
until: pkg_result is success
2018-04-23 09:21:32 +02:00
when: arpwatch__enabled|bool
# Manage configuration file [[[1
## Manage Arpwatch configuration [[[
2018-04-23 11:46:01 +02:00
- name: Create Arpwatch configuration
2018-04-23 09:21:32 +02:00
template:
src: '{{ arpwatch__conf_src }}'
dest: "/etc/arpwatch.conf"
2018-04-23 11:46:01 +02:00
owner: root
group: root
mode: '0644'
2019-02-27 12:03:05 +01:00
when: '{{ (arpwatch__enabled|bool) }}'
2018-04-23 09:21:32 +02:00
notify: ['restart arpwatch service']
# ]]]
## Manage service default [[[
- name: Manage service default
template:
2019-02-27 12:05:35 +01:00
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']
# ]]]
2018-04-23 09:21:32 +02:00
# Manage service [[[1
- name: Manage arpwatch service
service:
name: '{{ arpwatch__service_name }}'
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)) }}'