Why some modules just have doc but there is no code?

You’re looking at the module, but the actual code is an action plugin: lib/ansible/plugins/action/add_host.py

The add_host “module” and similar modules are actually “action” plugins since they should only run on the controller, not any inventory host.

2 Likes