···
5
-
- name: Ensure syslog-ng is installed
5
+
- name: Ensure rsyslog is installed
when: ansible_system == "Linux"
10
-
- name: Ensure syslog-ng is enabled
10
+
- name: Ensure rsyslog is enabled
ansible.builtin.systemd_service:
when: ansible_service_mgr == "systemd"
- name: Remove any forwarding file if exists
18
-
path: /etc/syslog-ng/conf.d/forward.conf
18
+
path: /etc/rsyslog.d/forward.conf
when: ansible_system == "Linux"
21
-
- name: Get remote logging server tailnet IP address
22
-
ansible.builtin.shell: tailscale status | grep "nas-aux" | awk '{print $1}'
23
-
register: ctrl_tailnet_ip_addr
21
+
- name: Get remote logging server headnet IP address
22
+
ansible.builtin.shell: tailscale status | grep "desktop" | awk '{print $1}'
23
+
register: ctrl_headnet_ip_addr
25
-
failed_when: ctrl_tailnet_ip_addr.rc != 0
26
-
- name: Configure log forwarding (Debian)
25
+
failed_when: ctrl_headnet_ip_addr.rc != 0
26
+
- name: Configure log forwarding
ansible.builtin.blockinfile:
28
-
path: /etc/syslog-ng/conf.d/forward.conf
28
+
path: /etc/rsyslog.d/forward.conf
34
-
# Forward to nas-aux ({{ctrl_tailnet_ip_addr.stdout}})
35
-
destination d_ewmm {
36
-
syslog-ng(server("{{ctrl_tailnet_ip_addr.stdout}}"));
41
-
destination(d_ewmm);
43
-
when: ansible_os_family == "Debian"
44
-
- name: Configure log forwarding (Red Hat)
45
-
ansible.builtin.blockinfile:
46
-
path: /etc/syslog-ng/conf.d/forward.conf
52
-
# Forward to nas-aux ({{ctrl_tailnet_ip_addr.stdout}})
53
-
destination d_ewmm {
54
-
syslog-ng(server("{{ctrl_tailnet_ip_addr.stdout}}"));
59
-
destination(d_ewmm);
61
-
when: ansible_os_family == "RedHat"
62
-
- name: Restart syslog-ng
34
+
# Forward to desktop.ayu-matrix.ts.net ({{ctrl_headnet_ip_addr.stdout}})
35
+
*.* action(type="omfwd" target="{{ctrl_headnet_ip_addr.stdout}}" port="514" protocol="tcp"
36
+
action.resumeRetryCount="100"
37
+
queue.type="linkedList" queue.size="10000")
38
+
when: ansible_system == "Linux"
39
+
- name: Restart rsyslog
ansible.builtin.systemd_service:
when: ansible_service_mgr == "systemd"
···
ansible.builtin.lineinfile:
77
-
line: "*.* @{{ctrl_tailnet_ip_addr.stdout}}"
54
+
line: "*.* @{{ctrl_headnet_ip_addr.stdout}}"