create syslogd role and enable it on openbsd
This commit is contained in:
parent
13f0332fa1
commit
c1db2dc402
3 changed files with 33 additions and 0 deletions
|
@ -54,5 +54,6 @@
|
||||||
name: "{{ role }}"
|
name: "{{ role }}"
|
||||||
with_items:
|
with_items:
|
||||||
- pf
|
- pf
|
||||||
|
- syslogd
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: role
|
loop_var: role
|
||||||
|
|
5
roles/syslogd/handlers/main.yml
Normal file
5
roles/syslogd/handlers/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
- name: restart syslogd
|
||||||
|
service:
|
||||||
|
name: syslogd
|
||||||
|
state: restarted
|
27
roles/syslogd/tasks/main.yml
Normal file
27
roles/syslogd/tasks/main.yml
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: verify that all.log exists
|
||||||
|
stat:
|
||||||
|
path: /var/log/all.log
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: create dummy all.log file
|
||||||
|
file:
|
||||||
|
path: /var/log/all.log
|
||||||
|
state: touch
|
||||||
|
mode: 0644
|
||||||
|
owner: root
|
||||||
|
group: "{{ ansible_wheel }}"
|
||||||
|
when: not result.stat.exists
|
||||||
|
|
||||||
|
- name: enable all.log
|
||||||
|
lineinfile:
|
||||||
|
path: /etc/syslog.conf
|
||||||
|
line: "*.* /var/log/all.log"
|
||||||
|
notify: restart syslogd
|
||||||
|
|
||||||
|
- name: enable all.log rotation
|
||||||
|
lineinfile:
|
||||||
|
path: /etc/newsyslog.conf
|
||||||
|
regexp: "^/var/log/all.log.*"
|
||||||
|
line: "/var/log/all.log root:{{ ansible_wheel }} 640 7 * $D0 Z"
|
Loading…
Add table
Reference in a new issue