Q:

ansible to restart network service

I copy-pasted this from the manual and it fails in my playbook (version 2.0.2):
- service: name=network state=restarted args=eth0

I am getting this error: 
"msg": "Failed to stop eth0.service: Unit eth0.service not loaded.\nFailed to start eth0.service: Unit eth0.service failed to load: No such file or directory.\n"}

What is the correct syntax, please?

A:

Just do like this (@nasr already commented it):
- name: Restart network
  service:
    name: network
    state: restarted

But if you change network configuration before restart, something like IP address, after restart ansible hangs because connection is lost (IP address changed).

