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
|
2024-04-14 22:51:22 +00:00
|
|
|
dest: "{{ rsyslog_config_path }}"
|
2019-11-03 17:31:08 +00:00
|
|
|
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
|
2024-04-14 22:51:22 +00:00
|
|
|
dest: "{{ rsyslog_etc_path }}/50-default.conf"
|
2019-11-03 17:31:08 +00:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
notify: restart rsyslog
|
|
|
|
when: rsyslog_default_rules_state == "file"
|
|
|
|
|
|
|
|
- name: manage default rules
|
|
|
|
file:
|
2024-04-14 22:51:22 +00:00
|
|
|
path: "{{ rsyslog_etc_path }}/50-default.conf"
|
2019-11-03 17:31:08 +00:00
|
|
|
state: "{{ rsyslog_default_rules_state }}"
|
2024-04-14 22:51:22 +00:00
|
|
|
notify: restart rsyslog
|
|
|
|
|
|
|
|
- name: configure rsyslog.d rules
|
|
|
|
ansible.builtin.copy:
|
|
|
|
dest: "{{ rsyslog_etc_path }}/{{ item.priority }}-{{ item.name }}.conf"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
content: "{{ item.content }}"
|
|
|
|
loop: "{{ rsyslog_d | default([]) }}"
|
|
|
|
notify: restart rsyslog
|
2019-11-03 17:31:08 +00:00
|
|
|
|
|
|
|
- name: manage service
|
|
|
|
service:
|
|
|
|
name: "{{ rsyslog_service_name }}"
|
|
|
|
state: "{{ rsyslog_service_state }}"
|
|
|
|
enabled: "{{ rsyslog_service_enabled }}"
|