2019-11-03 17:31:08 +00:00
|
|
|
- name: gather OS specific variables
|
2022-08-31 03:19:06 +00:00
|
|
|
ansible.builtin.include_vars: "{{ item }}"
|
2019-11-03 17:31:08 +00:00
|
|
|
with_first_found:
|
|
|
|
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yaml"
|
|
|
|
- "{{ ansible_distribution }}.yaml"
|
|
|
|
- "{{ ansible_os_family }}.yaml"
|
|
|
|
|
|
|
|
- name: install package
|
|
|
|
package:
|
2022-08-30 11:48:21 +00:00
|
|
|
name: "{{ item }}"
|
2019-11-03 17:31:08 +00:00
|
|
|
state: "{{ rsyslog_package_state }}"
|
2022-08-30 11:48:21 +00:00
|
|
|
loop: "{{ rsyslog_package_name }}"
|
2019-11-03 17:31:08 +00:00
|
|
|
|
|
|
|
- name: configure
|
|
|
|
template:
|
|
|
|
src: rsyslog.conf.j2
|
|
|
|
dest: /etc/rsyslog.conf
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
notify: restart rsyslog
|
|
|
|
|
|
|
|
- name: configure archival format
|
2022-08-31 03:19:06 +00:00
|
|
|
ansible.builtin.include_tasks: archival.yaml
|
2019-11-03 17:31:08 +00:00
|
|
|
|
|
|
|
- name: configure default rules
|
|
|
|
template:
|
|
|
|
src: default.conf.j2
|
|
|
|
dest: /etc/rsyslog.d/50-default.conf
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
notify: restart rsyslog
|
|
|
|
when: rsyslog_default_rules_state == "file"
|
|
|
|
|
|
|
|
- name: manage default rules
|
|
|
|
file:
|
|
|
|
path: /etc/rsyslog.d/50-default.conf
|
|
|
|
state: "{{ rsyslog_default_rules_state }}"
|
|
|
|
|
|
|
|
- name: manage service
|
|
|
|
service:
|
|
|
|
name: "{{ rsyslog_service_name }}"
|
|
|
|
state: "{{ rsyslog_service_state }}"
|
|
|
|
enabled: "{{ rsyslog_service_enabled }}"
|