command module

The module that runs any program you name on the host and reports what it printed, without being able to tell whether it changed anything.

In more detail

Because it cannot know what the command did, it reports changed every time, so it is not idempotent unless you add changed_when or a similar guard. Its result includes the return code (rc) and the output. Prefer a dedicated module when one exists, and reach for command for questions such as uname -s or id -u.

Example

ansible all -m ansible.builtin.command -a "echo hello"

Related terms

Taught in

References

Certification courses