--- - name: Restart mongod service: name=mongod state=restarted when: "'{{ mongodb_start_server }}' == 'yes'" - name: Restart mongodb service: name=mongodb state=restarted ignore_errors: true when: "'{{ mongodb_start_server }}' == 'yes'"