Skip to content

/etc/rsyslog.conf edits with ansible

The host called “wmd1” used to be the remote logger for all the LINUX boxes in the “left” data center. In the “right” data center it was “wmd2”. For whatever reason its replacement in the “left” data center is now called “wmd7”. The rest is Ansible playbook allowing for a mass edits across all the “left” boxes.

- hosts:
  remote_user: root

   - name: copy /etc/rsyslog.conf to /etc/rsyslog.conf.OLD
     copy: src=/etc/rsyslog.conf dest=/etc/rsyslog.conf.OLD force=no

   - name: replace the name of remote logger or insert it if missing
     shell: grep .*wmd.*\ /etc/rsyslog.conf && sed --in-place 's/wmd.*\' /etc/rsyslog.conf || echo '*.*' >> /etc/rsyslog.conf ; service rsyslog restart

The shell line is one long line – there are no folding characters above.

Posted in Linux, LINUX.

Tagged with , , , .

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

or, reply to this post via trackback.

WordPress Anti Spam by WP-SpamShield

Copyright © 2016 - 2018 Waldemar Mark Duszyk. All Rights Reserved. Created by Blog Copyright.