---

- name: install rsyslog
  yum: name=rsyslog state=installed
  become: true
  become_user: root
  when: ansible_os_family == 'RedHat'

- name: install rsyslog
  apt: name=rsyslog state=installed
  become: true
  become_user: root
  when: ansible_os_family == 'Debian'

- name: install rsyslogd.conf
  template: src=rsyslog.conf.j2 dest=/etc/rsyslog.conf owner=root group=root mode=644
  become: true
  become_user: root
  register: config_changed

- name: restart rsyslog
  service: name=rsyslog state=restarted
  become: true
  become_user: root
  when: config_changed is changed
