This is my example.
start rsyslog
- hosts: all
tasks:
- name: Install rsyslog-v8 yum repo
template:
src: files/rsyslog.repo
dest: /etc/yum.repos.d/rsyslog.repo
- name: Install rsyslog-v8 package
yum:
name: rsyslog
state: latest
- name: Stop rsyslog
systemd:
name: rsyslog
state: stopped
- name: cleann up /var/spool/rsyslog
shell: /bin/rm -rf /var/spool/rsyslog/*
- name: Start rsyslog
systemd:
name: rsyslog
state: started