--- - name: MongoDB Process Check shell: pgrep mongod | wc -l register: command_result tags: [mongodb] - name: Run MongoDB shell: "mongod --replSet=bigchain-rs --logpath {{ mongodb_log_path }}/mongod.log &" when: command_result.stdout| int != 1 tags: [mongodb]