- name: gather OS specific variables ansible.builtin.include_vars: "{{ item }}" with_first_found: - "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yaml" - "{{ ansible_distribution }}.yaml" - "{{ ansible_os_family }}.yaml" - name: install package package: name: "{{ item }}" state: "{{ rsyslog_package_state }}" loop: "{{ rsyslog_package_name }}" - name: configure template: src: rsyslog.conf.j2 dest: "{{ rsyslog_config_path }}" owner: root group: root mode: 0644 notify: restart rsyslog - name: configure archival format ansible.builtin.include_tasks: archival.yaml - name: configure default rules template: src: default.conf.j2 dest: "{{ rsyslog_etc_path }}/50-default.conf" owner: root group: root mode: 0644 notify: restart rsyslog when: rsyslog_default_rules_state == "file" - name: manage default rules file: path: "{{ rsyslog_etc_path }}/50-default.conf" state: "{{ rsyslog_default_rules_state }}" 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 - name: manage service service: name: "{{ rsyslog_service_name }}" state: "{{ rsyslog_service_state }}" enabled: "{{ rsyslog_service_enabled }}"