ansible-modules — stock modules shipped with ansible
Ansible ships with a number of modules that can be executed directly on remote hosts or through ansible playbooks.
Most modules other than command are idempotent, meaning they will seek to avoid changes unless a change needs to be made. When using ansible playbooks, these modules can trigger change events, as described in ansible-playbooks(5).
Unless otherwise noted, all modules support change hooks.
The command module takes the command name followed by a list of arguments, space delimited. This is the only module that does not use key=value style parameters.
This module does not support change hooks.
Returns the return code from the program as well as timing information.
(Async command running and command execution time limits are in plan.)
The copy module moves a file on the local box to remote locations.
This module also returns md5sum information about the resultant file.
Runs the discovery program facter on the remote system, returning JSON data that can be useful for inventory purposes.
Requires that facter and ruby-json be installed on the remote end.
This module is informative only - it takes no parameters & does not support change hooks, nor does it make any changes on the system.
Ensures the ownership and permissions of files are as desired.
Use copy or template first if you need to make sure a file is on the box.
In plan.
Deploys software from git checkouts.
Similar to the facter module, this returns JSON inventory data. Ohai data is a bit more verbose and nested than facter.
Requires that ohai be installed on the remote end.
This module is information only - it takes no parameters & does not support change hooks, nor does it make any changes on the system.
A trivial test module, this module always returns the integer 1 on successful contact.
This module does not support change hooks.
This module is informative only - it takes no parameters & does not support change hooks, nor does it make any changes on the system.
Controls services on remote machines.
Writes a JSON file containing key/value data, for use in templating. Call this once before using the template modules, usually as the very first step in your playbook.
If facter or ohai are installed, variables from these programs will also be snapshotted into the JSON file for usage in templating. These variables are prefixed with facter_ and 'ohai_" so it’s easy to tell their source.
Templates a file out to a remote server. Call the setup module prior to usage.
This module also returns md5sum information about the resultant file.
To write your own modules, simply follow the convention of those already available in /usr/share/ansible. Modules must return JSON but can be written in any language. To support change hooks, modules should return hashes, with a changed: True/False element at the top level. Modules can also choose to indicate a failure scenario by returning a top level failure element with a True value.