Jack Moore

Email: jack(at)jmoore53.com
Project Updates

Ansible to Configure Syslog

15 Dec 2021 » ansible, automation, configuration

Easy rsyslog configuration of remote servers via ansible:

---
- name: Update Syslog
  remote_user: ansible-system
  gather_facts: true
  hosts: all
  become: yes
  become_user: root
  become_method: sudo
  tasks:

    - name: Copy Rsyslog Template
      ansible.builtin.template:
        src: rsyslog.conf.j2
        dest: /etc/rsyslog.conf
        owner: root
        group: root
        mode: '0644'

    - name: Reload Syslog Service
      service: name=rsyslog state=restarted

And then appending this line to the end of the conf file via a template file rsyslog.conf.j2:

*.* @10.0.X.X:514
© Jack Moore