From 45508b9f998a47c0fd09bc25e7743f769f5bc15b Mon Sep 17 00:00:00 2001 From: deimosfr Date: Thu, 26 Feb 2015 15:11:22 +0100 Subject: [PATCH] fix regression on non systemd debian --- handlers/main.yml | 1 + tasks/configure.yml | 9 ++------- tasks/install.deb.yml | 8 +++++--- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 04e3eaf..5d9f527 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -11,3 +11,4 @@ - name: reload systemd shell: systemctl daemon-reload + when: systemd.stat.exists == true diff --git a/tasks/configure.yml b/tasks/configure.yml index d796c8a..14fad3e 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -13,17 +13,12 @@ template: src=logrotate.conf.j2 dest=/etc/logrotate.d/mongodb.conf when: mongodb_logrotate -#- name: reload systemd -# shell: systemctl daemon-reload -# when: systemd.stat.exists == true -# changed_when: false - - name: ensure mongodb started and enabled service: name={{ mongodb_daemon_name }} state=started enabled=yes - name: wait MongoDB port is listening - wait_for: host="{{ mongodb_conf_bind_ip }}"port="{{ mongodb_conf_port }}" delay=5 state=started - when: systemd.stat.exists == true + wait_for: host="{{ mongodb_conf_bind_ip }}"port="{{ mongodb_conf_port }}" delay=10 timeout=60 state=started + #when: systemd.stat.exists == true - include: auth_initialization.yml when: mongodb_conf_auth diff --git a/tasks/install.deb.yml b/tasks/install.deb.yml index 5bddce5..b9cce2c 100644 --- a/tasks/install.deb.yml +++ b/tasks/install.deb.yml @@ -3,7 +3,7 @@ - include_vars: "{{ansible_distribution}}.yml" - name: Check if systemd is present - stat: path=/lib/systemd/system/ + stat: path=/bin/systemd register: systemd - name: Add systemd configuration if present @@ -28,9 +28,11 @@ - name: Install MongoDB package apt: pkg={{mongodb_package}} state=present - notify: reload systemd -- meta: flush_handlers +- name: reload systemd + shell: systemctl daemon-reload + changed_when: false + when: systemd.stat.exists == true - name: Install additional packages apt: pkg={{item}}