-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #410 from cradle8810/rsyslog
Rsyslog Initial configuration
- Loading branch information
Showing
13 changed files
with
140 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
apt: | ||
- curl | ||
- dstat | ||
- htop | ||
- qemu-guest-agent | ||
- rsyslog | ||
|
||
services_start: | ||
- qemu-guest-agent | ||
|
||
firewall: | ||
policy: deny | ||
allow_rules: | ||
- name: "SSH from service line" | ||
proto: "tcp" | ||
src: "192.168.1.0/24" | ||
port: '22' | ||
- name: "Rsyslog(UDP) from service line" | ||
proto: "udp" | ||
src: "192.168.1.0/24" | ||
port: '514' | ||
- name: "Rsyslog(TCP) from service line" | ||
proto: "tcp" | ||
src: "192.168.1.0/24" | ||
port: '514' | ||
|
||
drives: | ||
hayaworld: | ||
uuid: "eae4947a-1397-48f6-a4c0-c13a3cc30c2a" | ||
mountpoint: "/var/log/hayaworld" | ||
filesystem: "btrfs" | ||
options: "defaults,noatime,compress=zstd:1" | ||
|
||
syslog: | ||
logdir: "/var/log/hayaworld" | ||
actions: | ||
- facility: "local5" | ||
priority: "*" | ||
file: "local5.log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
- name: Play for log.hayaworld.home | ||
hosts: log | ||
remote_user: hayato | ||
gather_facts: true | ||
become: true | ||
|
||
vars_files: | ||
- inventories/host_vars/log.yml | ||
- inventories/host_vars/networks.yml | ||
|
||
handlers: | ||
- name: Restart handler tasks | ||
ansible.builtin.import_tasks: | ||
file: handlers/main.yml | ||
|
||
tasks: | ||
- name: Common Settings | ||
ansible.builtin.import_tasks: | ||
file: tasks/all/main.yml | ||
|
||
- name: "Install Rsyslog" | ||
ansible.builtin.import_tasks: | ||
file: tasks/log/install_rsyslog.yml | ||
tags: | ||
- rsyslog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
- name: "Make hayaworld logs mountpoint" | ||
ansible.builtin.file: | ||
path: "{{ drives.hayaworld.mountpoint }}" | ||
state: directory | ||
owner: syslog | ||
group: adm | ||
mode: '0755' | ||
|
||
- name: "Mount drive" | ||
ansible.posix.mount: | ||
src: "UUID={{ drives.hayaworld.uuid }}" | ||
path: "{{ drives.hayaworld.mountpoint }}" | ||
fstype: "{{ drives.hayaworld.filesystem }}" | ||
opts: "{{ drives.hayaworld.options }}" | ||
state: mounted | ||
|
||
- name: "Install rsyslog" | ||
ansible.builtin.apt: | ||
pkg: | ||
- rsyslog | ||
|
||
- name: "Put rsyslog conf" | ||
ansible.builtin.template: | ||
src: "{{ item.src }}" | ||
dest: "{{ item.dest }}" | ||
owner: root | ||
group: root | ||
mode: '0644' | ||
notify: "Restart rsyslog" | ||
loop: | ||
- src: templates/log/etc/rsyslog.d/10-hayaworld.conf | ||
dest: /etc/rsyslog.d/10-hayaworld.conf | ||
- src: templates/log/etc/rsyslog.conf | ||
dest: /etc/rsyslog.conf | ||
|
||
- name: "Enable rsyslog" | ||
ansible.builtin.systemd_service: | ||
name: systemd-resolved.service | ||
state: started | ||
enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
_ | ||
| | ___ __ _ | ||
| |/ _ \ / _` | | ||
| | (_) | (_| | | ||
|_|\___/ \__, | | ||
|___/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{% for list in syslog.actions %} | ||
{{ list.facility }}.{{ list.priority }} {{ syslog.logdir }}/{{ list.file }} | ||
{% endfor %} | ||
& stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{{ dnsmasq.logs.log_facility }}.* @{{ dnsmasq.logs.log_to }} | ||
& stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{{ dnsmasq.logs.log_facility }}.* @{{ dnsmasq.logs.log_to }} | ||
& stop |