You may not need to use the getent module at all - the group module already uses groupmod if the group already exists.
If you want to use getent, then it looks like you are missing '_' characters in the "when" conditions. They should be
when: getent_passwd ...
and
when: getent_group ...
respectively. And there's a typo in your last call to the group module, "git" should be "gid".
You could move the items list into host_vars and then iterate just the groups the host needs, you can have the items list in group_vars that need the groups on the systems, there are lots of ways to partition that up.