Ensure rsyslog restarts after configuration file changes

Added rsyslog restart handlers to each rsyslog_client_post_install task.
There was an issue when rsyslog_client_post_install would stop its service,
it would automatically get restarted and the service would not listen
for incoming logs. This now ensures that the rsyslog service will
be restarted after configuration files are changed.

Change-Id: I0cc9dd512fba6a1d583bf861a645097ae7c1d852
Partial-Bug: 1636017
This commit is contained in:
Yogesh Mulay 2017-02-23 14:15:53 -05:00 committed by Yogesh Mulay
parent d5f754edfd
commit c902307da5
2 changed files with 13 additions and 15 deletions

7
handlers/main.yml Normal file
View File

@ -0,0 +1,7 @@
---
- name: restart rsyslog
service:
name: rsyslog
state: restarted

View File

@ -13,14 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Stop rsyslog
service:
name: "rsyslog"
state: "stopped"
failed_when: false
tags:
- rsyslog_client-install
- name: Rsyslog Setup
copy:
src: "50-default.conf"
@ -29,6 +21,8 @@
group: "root"
tags:
- rsyslog_client-install
notify:
- restart rsyslog
- name: Check if log dir exists
stat:
@ -75,6 +69,8 @@
group: "root"
tags:
- rsyslog_client-config
notify:
- restart rsyslog
- name: Write rsyslog target file
template:
@ -85,6 +81,8 @@
when: (rsyslog_client_all_log_files | length) > 0
tags:
- rsyslog_client-config
notify:
- restart rsyslog
- name: Write log rotate file
template:
@ -104,10 +102,3 @@
backrefs: yes
tags:
- rsyslog_client-install
- name: Start rsyslog
service:
name: "rsyslog"
state: "started"
tags:
- rsyslog_client-config