ajout playboook syslog
This commit is contained in:
parent
ceece5a13c
commit
d86d83103d
45
sio2/CYBER/Ansible/syslog-cli.yml
Normal file
45
sio2/CYBER/Ansible/syslog-cli.yml
Normal file
@ -0,0 +1,45 @@
|
||||
---
|
||||
- name: syslog.yml
|
||||
hosts: web
|
||||
tasks:
|
||||
- name: 1. installer rsyslog
|
||||
apt:
|
||||
name: rsyslog
|
||||
state: latest
|
||||
|
||||
- name: ajout du serveur syslog distant
|
||||
lineinfile:
|
||||
path: /etc/rsyslog.conf
|
||||
line: '*.* @172.20.10.4:514'
|
||||
insertbefore: EOF
|
||||
create: yes
|
||||
notify:
|
||||
- 5. redemarrer rsyslog
|
||||
|
||||
# - name: 3. Ajout de la ligne ForwardToSyslog
|
||||
#shell: echo "ForwardToSyslog=yes" >> /etc/systemd/journald.conf
|
||||
|
||||
- name: 4. Decommente la ligne ForwardToSyslog
|
||||
replace:
|
||||
path: /etc/systemd/journald.conf
|
||||
regexp: '^#ForwardToSyslog=yes'
|
||||
replace: 'ForwardToSyslog=yes'
|
||||
notify: 6. redemarrer journald.service
|
||||
|
||||
# notify:
|
||||
#- restart rsyslog
|
||||
#- name: redemarrage de syslog
|
||||
#- restart journald.service
|
||||
#- name: redemarrage de journald.service
|
||||
|
||||
handlers:
|
||||
- name: 5. redemarrer rsyslog
|
||||
service:
|
||||
name: rsyslog
|
||||
state: restarted
|
||||
|
||||
- name: 6. redemarrer journald.service
|
||||
service:
|
||||
name: systemd-journald.service
|
||||
state: restarted
|
||||
|
52
sio2/CYBER/Ansible/syslog.yml
Normal file
52
sio2/CYBER/Ansible/syslog.yml
Normal file
@ -0,0 +1,52 @@
|
||||
---
|
||||
- name: syslog.yml
|
||||
hosts: infra
|
||||
tasks:
|
||||
- name: 1. installer rsyslog
|
||||
apt:
|
||||
name: rsyslog
|
||||
state: latest
|
||||
|
||||
- name: 2. decommente le chargement du module imudp dans rsyslog.conf
|
||||
replace:
|
||||
path: /etc/rsyslog.conf
|
||||
regexp: '^#module\(load="imudp"\)'
|
||||
replace: 'module(load="imudp")'
|
||||
notify:
|
||||
- 5. redemarrer rsyslog
|
||||
|
||||
- name: 3. decommente le chargement du module imudp port 514 dans rsyslog.conf
|
||||
replace:
|
||||
path: /etc/rsyslog.conf
|
||||
regexp: '^#input\(type="imudp" port="514"\)'
|
||||
replace: 'input(type="imudp" port="514")'
|
||||
notify:
|
||||
- 5. redemarrer rsyslog
|
||||
|
||||
# - name: 3. Ajout de la ligne ForwardToSyslog
|
||||
#shell: echo "ForwardToSyslog=yes" >> /etc/systemd/journald.conf
|
||||
|
||||
- name: 4. Decommente la ligne ForwardToSyslog
|
||||
replace:
|
||||
path: /etc/systemd/journald.conf
|
||||
regexp: '^#ForwardToSyslog=yes'
|
||||
replace: 'ForwardToSyslog=yes'
|
||||
notify: 6. redemarrer journald.service
|
||||
|
||||
# notify:
|
||||
#- restart rsyslog
|
||||
#- name: redemarrage de syslog
|
||||
#- restart journald.service
|
||||
#- name: redemarrage de journald.service
|
||||
|
||||
handlers:
|
||||
- name: 5. redemarrer rsyslog
|
||||
service:
|
||||
name: rsyslog
|
||||
state: restarted
|
||||
|
||||
- name: 6. redemarrer journald.service
|
||||
service:
|
||||
name: systemd-journald.service
|
||||
state: restarted
|
||||
|
Loading…
x
Reference in New Issue
Block a user