--- - name: MongoDB config files are copied copy: src: "{{ item.src }}" dest: "{{ item.dest }}" with_items: "{{ mongodb_conf_files }}" tags: [mongodb] - name: MongoDB Process Check shell: pgrep mongod | wc -l register: command_result tags: [mongodb] - name: Install pymongo pip: name: pymongo state: present tags: [mongodb] - name: Run MongoDB shell: "mongod --config {{ mongodb_conf_file }} 2>&1 &" when: command_result.stdout| int != 1 async: 5 poll: 0 tags: [mongodb]