Skip to content

Commit

Permalink
Merge pull request #19 from punktDe/rsyslog-precise-timestamps
Browse files Browse the repository at this point in the history
Enable precise timestamps for rsyslog on Linux
  • Loading branch information
medanthelinium authored Nov 7, 2024
2 parents 2c41527 + f101499 commit b7a8fd2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ system:
config:
PasswordAuthentication: no
PermitRootLogin: no
rsyslog:
precise_timestamps: no
features:
rsyslog: "{{ ansible_system == 'Linux' }}"
sshd: yes
proserver_fact: no
hostname: yes
Expand Down
5 changes: 5 additions & 0 deletions handlers/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@
- name: Reload systemd units
ansible.builtin.systemd:
daemon_reload: yes

- name: Restart rsyslog
ansible.builtin.systemd:
name: rsyslog
state: restarted
3 changes: 3 additions & 0 deletions tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
- ansible.builtin.include_tasks: proserver_fact.yaml

Check warning on line 7 in tasks/main.yaml

View workflow job for this annotation

GitHub Actions / lint

name[missing]

All tasks should be named.

Check warning on line 7 in tasks/main.yaml

View workflow job for this annotation

GitHub Actions / lint

name[missing]

All tasks should be named.
when: system.features.proserver_fact

- ansible.builtin.include_tasks: rsyslog.yaml

Check warning on line 10 in tasks/main.yaml

View workflow job for this annotation

GitHub Actions / lint

name[missing]

All tasks should be named.

Check warning on line 10 in tasks/main.yaml

View workflow job for this annotation

GitHub Actions / lint

name[missing]

All tasks should be named.
when: system.features.rsyslog

- ansible.builtin.include_tasks: hostname.yaml

Check warning on line 13 in tasks/main.yaml

View workflow job for this annotation

GitHub Actions / lint

name[missing]

All tasks should be named.

Check warning on line 13 in tasks/main.yaml

View workflow job for this annotation

GitHub Actions / lint

name[missing]

All tasks should be named.
when: system.features.hostname

Expand Down
10 changes: 10 additions & 0 deletions tasks/rsyslog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Ensure precise timestamps are enabled for rsyslog
notify: Restart rsyslog
when: system.rsyslog.precise_timestamps
ansible.builtin.lineinfile:
path: /etc/rsyslog.conf
regexp: '^\$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat$'
line: '#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat'
owner: root
mode: "0644"

0 comments on commit b7a8fd2

Please sign in to comment.