2016-10-30 20:40:48 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: install fprobe from packages
|
2018-12-21 08:00:53 +01:00
|
|
|
package: name={{ fprobe_pkg }} state=present
|
|
|
|
register: pkg_result
|
|
|
|
until: pkg_result is success
|
2016-10-30 20:40:48 +01:00
|
|
|
|
|
|
|
- name: Debian | update fprobe config
|
|
|
|
replace: "dest=/etc/default/fprobe regexp={{ item.re }} replace={{ item.rep }} backup=yes"
|
|
|
|
with_items:
|
|
|
|
- { re: '^INTERFACE=.*', rep: "INTERFACE=\"{{ fprobe_if }}\"" }
|
|
|
|
- { re: '^FLOW_COLLECTOR=.*', rep: "FLOW_COLLECTOR=\"{{ fprobe_flow_collector }}\"" }
|
|
|
|
- { re: '^OTHER_ARGS=.*', rep: "OTHER_ARGS=\"{{ fprobe_args }}\"" }
|
|
|
|
when: ansible_os_family == 'Debian'
|
|
|
|
notify:
|
|
|
|
- restart fprobe
|
|
|
|
- name: RedHat | update fprobe config
|
|
|
|
lineinfile: "dest=/etc/sysconfig/fprobe regexp={{ item.re }} line={{ item.rep }} backup=yes create=yes"
|
|
|
|
with_items:
|
|
|
|
- { re: '^FLOW_COLLECTOR=.*', rep: "FLOW_COLLECTOR=\"{{ fprobe_flow_collector }}\"" }
|
|
|
|
# - { re: '^OTHER_ARGS=.*', rep: "OTHER_ARGS=\"{{ fprobe_args }}\"" }
|
|
|
|
when: ansible_os_family == 'RedHat'
|
|
|
|
notify:
|
|
|
|
|
|
|
|
#- block:
|
|
|
|
# - name: RedHat | check if fprobe is running
|
|
|
|
# shell: "ps axu |grep fprobe-ulog"
|
|
|
|
# register: ps
|
|
|
|
# changed_when: false
|
|
|
|
# - name: RedHat | start fprobe manually
|
|
|
|
# command: "fprobe-ulog -c /var/tmp {{ fprobe_flow_collector }}"
|
2018-12-21 08:00:53 +01:00
|
|
|
# when: >
|
|
|
|
# ansible_os_family == 'RedHat' and ps is defined and ps.stdout is defined and
|
|
|
|
# ps.stdout.find(" fprobe-ulog ") == -1
|
2016-10-30 20:40:48 +01:00
|
|
|
|
2017-04-17 01:50:25 +02:00
|
|
|
- block:
|
|
|
|
- name: install fprobe systemd configuration
|
|
|
|
template:
|
|
|
|
src: "systemd-fprobe-ulog.service.j2"
|
|
|
|
dest: "/lib/systemd/system/{{ fprobe_svc }}.service"
|
|
|
|
mode: '0644'
|
|
|
|
backup: yes
|
|
|
|
register: systemdconf
|
|
|
|
ignore_errors: true
|
|
|
|
- block:
|
|
|
|
- include: "immutable.yml target_dir=/lib/systemd/system state=pre"
|
|
|
|
- name: install fprobe systemd configuration
|
|
|
|
template:
|
|
|
|
src: "systemd-fprobe-ulog.service.j2"
|
|
|
|
dest: "/lib/systemd/system/{{ fprobe_svc }}.service"
|
|
|
|
mode: '0644'
|
|
|
|
backup: yes
|
|
|
|
- include: "immutable.yml target_dir=/lib/systemd/system state=post"
|
|
|
|
when: systemdconf|failed
|
2017-01-07 09:55:05 +01:00
|
|
|
when: ansible_service_mgr == 'systemd'
|
2017-04-17 01:50:25 +02:00
|
|
|
- block:
|
|
|
|
- name: add fprobe init.d script
|
|
|
|
template:
|
|
|
|
src: init.d-fprobe.j2
|
|
|
|
dest: /etc/rc.d/init.d/fprobe-ulog
|
|
|
|
mode: '0755'
|
|
|
|
backup: yes
|
|
|
|
register: initdconf
|
|
|
|
ignore_errors: true
|
|
|
|
- block:
|
|
|
|
- include: "immutable.yml target_dir=/etc/rc.d/init.d state=pre"
|
|
|
|
- name: install fprobe systemd configuration
|
|
|
|
template:
|
|
|
|
src: init.d-fprobe.j2
|
|
|
|
dest: /etc/rc.d/init.d/fprobe-ulog
|
|
|
|
mode: '0755'
|
|
|
|
backup: yes
|
|
|
|
- include: "immutable.yml target_dir=/etc/rc.d/init.d state=post"
|
|
|
|
when: initdconf|failed
|
|
|
|
when: ansible_os_family == 'RedHat' and ansible_service_mgr != 'systemd'
|
2016-10-30 20:40:48 +01:00
|
|
|
|
|
|
|
- name: ensure service is enabled and started
|
|
|
|
service: name={{ fprobe_svc }} state=started enabled=yes
|
|
|
|
## fail on trusty and centos7 but works in cli
|
|
|
|
ignore_errors: true
|
|
|
|
|
2017-07-15 18:33:48 +02:00
|
|
|
- name: ensure service is started - again
|
|
|
|
service: name={{ fprobe_svc }} state=started
|