Reduce output from ansible playbooks. Some minor changes.
This commit is contained in:
@@ -1,11 +1,118 @@
|
||||
---
|
||||
|
||||
- hosts: o25.oopen.de
|
||||
- hosts: extra_hosts
|
||||
|
||||
tasks:
|
||||
|
||||
- name: Ensure aptitude is present
|
||||
raw: test -e /usr/bin/aptitude || apt-get install aptitude -y
|
||||
- name: (apt.yml) apt update
|
||||
apt:
|
||||
update_cache: true
|
||||
cache_valid_time: "{{ 0 if apt_config_updated is defined and apt_config_updated.changed else apt_update_cache_valid_time }}"
|
||||
when: apt_update|bool
|
||||
|
||||
- name: (apt.yml) dpkg --configure
|
||||
command: >
|
||||
dpkg --configure -a
|
||||
args:
|
||||
warn: false
|
||||
changed_when: _dpkg_configure.stdout_lines | length
|
||||
register: _dpkg_configure
|
||||
when: apt_dpkg_configure|bool
|
||||
|
||||
- name: Install ulogd2
|
||||
apt:
|
||||
name: ulogd2
|
||||
state: present
|
||||
default_release: "{{ ansible_distribution_release }}"
|
||||
tags:
|
||||
- ulogd
|
||||
- apt-ulogd
|
||||
|
||||
- name: Check if file '/etc/ulogd.conf.ORIG' exists
|
||||
stat:
|
||||
path: /etc/ulogd.conf.ORIG
|
||||
register: ulogd_conf_orig_exists
|
||||
tags:
|
||||
- ulogd
|
||||
|
||||
- name: Backup existing file /etc/ulogd.conf
|
||||
command: cp /etc/ulogd.conf /etc/ulogd.conf.ORIG
|
||||
when: ulogd_conf_orig_exists.stat.exists == False
|
||||
tags:
|
||||
- ulogd
|
||||
|
||||
- name: Adjust file '/etc/ulogd.conf' 1/2
|
||||
blockinfile:
|
||||
path: /etc/ulogd.conf
|
||||
insertafter: '^#?\s*plugin="/usr/lib'
|
||||
block: |
|
||||
|
||||
# ====================================================================
|
||||
# Define two new plugin stacks inside for iptables logging
|
||||
# ====================================================================
|
||||
# -
|
||||
# - firewall11 - for IPv4 Firewall
|
||||
# - firewall12 - for IPv6 Firewall
|
||||
# -
|
||||
stack=firewall11:NFLOG,base1:BASE,ifi1:IFINDEX,ip2str1:IP2STR,print1:PRINTPKT,emu11:LOGEMU
|
||||
stack=firewall12:NFLOG,base1:BASE,ifi1:IFINDEX,ip2str1:IP2STR,print1:PRINTPKT,emu12:LOGEMU
|
||||
|
||||
marker: "# {mark} ANSIBLE MANAGED BLOCK 1/2"
|
||||
state: present
|
||||
register: ulogd_conf_1
|
||||
notify: Restart ulogd
|
||||
|
||||
- name: Adjust file '/etc/ulogd.conf' 2/2
|
||||
blockinfile:
|
||||
path: /etc/ulogd.conf
|
||||
insertafter: EOF
|
||||
block: |
|
||||
|
||||
# =========================================================
|
||||
# Define input plugins using specified netlink group inside
|
||||
# =========================================================
|
||||
[firewall11]
|
||||
group=11
|
||||
|
||||
[firewall12]
|
||||
group=12
|
||||
|
||||
|
||||
# =====================
|
||||
# Define output plugins
|
||||
# =====================
|
||||
|
||||
[emu11]
|
||||
file="/var/log/ulog/iptables.log"
|
||||
sync=1
|
||||
|
||||
[emu12]
|
||||
file="/var/log/ulog/ip6tables.log"
|
||||
sync=1
|
||||
|
||||
marker: "# {mark} ANSIBLE MANAGED BLOCK 2/2"
|
||||
state: present
|
||||
register: ulogd_conf_1
|
||||
notify: Restart ulogd
|
||||
|
||||
- name: Insert Headline to file '/etc/ulogd.conf'
|
||||
blockinfile:
|
||||
path: /etc/ulogd.conf
|
||||
insertbefore: BOF
|
||||
block: |
|
||||
#
|
||||
# --------------------------
|
||||
# ** DO NOT EDIT DIRECTLY **
|
||||
# --------------------------
|
||||
# Ansible managed file
|
||||
#
|
||||
marker: "# {mark}"
|
||||
|
||||
|
||||
handlers:
|
||||
|
||||
- name: Restart ulogd
|
||||
service:
|
||||
name: ulogd
|
||||
state: restarted
|
||||
|
||||
- name: Ensure python2 is present (This is necessary for ansible to work properly)
|
||||
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
|
||||
|
||||
Reference in New Issue
Block a user