From 46230630de502bead1e79d0b21bf65d63bcbd747 Mon Sep 17 00:00:00 2001 From: Sergei Antipov Date: Tue, 16 Jun 2015 17:32:39 +0600 Subject: [PATCH] Fixed logfile creation --- tasks/configure.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tasks/configure.yml b/tasks/configure.yml index 44851dd..a74e53f 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -63,11 +63,13 @@ - name: Create log dir if missing file: state=directory recurse=yes dest={{ mongodb_conf_logpath|dirname }} owner={{ mongodb_user }} group={{mongodb_user}} mode=0755 +- name: Check than logfile exists + stat: path={{ mongodb_conf_logpath }} + register: logfile_stat + - name: Create log if missing file: state=touch dest={{ mongodb_conf_logpath }} owner={{ mongodb_user }} group={{mongodb_user}} mode=0755 - -- name: Configure log file - file: state=file path={{ mongodb_conf_logpath }} owner={{mongodb_user}} group={{mongodb_user}} mode=0755 + when: logfile_stat is defined and not logfile_stat.stat.exists - name: Configure mongodb template: src=mongod.conf.j2 dest=/etc/mongod.conf backup=yes owner=root group=root mode=0644