Q:

Commands not working “with_item” in ansible playbook

I am new to ansible and trying to write a basic playbook for mongodb backup with simplest method.  here is what i am trying to do:
---
- hosts: mongo
  tasks:
  - name: Mongo Dump
    command: mongodump --out mdb_backup/mongodb_backup/
  - name: MongoDb Backup 
    command: "{{item}} chdir=~/mdb_backup/mongodb_backup/"
    with_items:
     - pwd
     - git add
     - git commit -m "Updates"
     - git push origin master

And my error is:
"warnings": ["Consider using git module rather than running git"]} [WARNING]: Consider using git module rather than running git

I have idea about ansible git module but I don't know how to use it in my scenario.  IS there anyone can help? 

A:

This only is a warning, your code should still work. 
The warnings are annoying sometimes because Ansible only checks for some simple strings and it's not very rare that the mentioned Ansible modules (git in this case) lack the features required to do so.  And that also is the case here.  The git module can only clone/checkout repositories but it can not add files, commit or push.  So you're not doing anything wrong there. 
To get rid of warning you could simply do this:
with_items:
  - pwd
  - `which git` add
  - `which git` commit -m "Updates"
  - `which git` push origin master

Now Ansible sees which and not git as the command.