2012-02-27 00:52:42 +01:00
|
|
|
ansible-modules(5)
|
|
|
|
=================
|
|
|
|
:doctype:manpage
|
|
|
|
:man source: Ansible-modules
|
|
|
|
:man version: 0.0.1
|
|
|
|
:man manual: System administration commands
|
|
|
|
|
|
|
|
|
|
|
|
NAME
|
|
|
|
----
|
|
|
|
ansible-modules - stock modules shipped with ansible
|
|
|
|
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
|
|
|
|
|
|
|
Ansible ships with a number of modules that can be executed directly on remote hosts or through
|
|
|
|
ansible playbooks.
|
|
|
|
|
|
|
|
|
|
|
|
IDEMPOTENCE
|
|
|
|
-----------
|
|
|
|
|
|
|
|
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. Unless otherwise noted, all modules support change hooks.
|
|
|
|
|
|
|
|
|
|
|
|
command
|
|
|
|
-------
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
2012-02-27 02:42:13 +01:00
|
|
|
Example usage::
|
2012-02-27 00:52:42 +01:00
|
|
|
|
2012-02-27 02:42:13 +01:00
|
|
|
/sbin/shutdown -t now
|
2012-02-27 00:52:42 +01:00
|
|
|
|
|
|
|
This module does not support change hooks.
|
|
|
|
|
|
|
|
Returns the return code from the program as well as timing information.
|
|
|
|
|
2012-02-27 01:21:44 +01:00
|
|
|
Async command running and command execution time limits are in plan. These will probably
|
|
|
|
be special keyvalue parameters expressed on the end of the command line, like ANSTIMEOUT=1
|
|
|
|
and ANS_ASYNC=1 or similar.
|
2012-02-27 00:52:42 +01:00
|
|
|
|
|
|
|
copy
|
|
|
|
----
|
|
|
|
|
|
|
|
The copy module takes a list of source files
|
|
|
|
|
|
|
|
*src=*::
|
|
|
|
|
|
|
|
Local absolute path to a file to copy to the remote server
|
|
|
|
|
|
|
|
|
|
|
|
*dest=*::
|
|
|
|
|
|
|
|
Remote absolute path where the file should end up
|
|
|
|
|
|
|
|
|
|
|
|
This module also returns md5sum information about the resultant file.
|
|
|
|
|
|
|
|
|
|
|
|
facter
|
|
|
|
------
|
|
|
|
|
|
|
|
Runs the discovery program 'facter' on the remote system, returning
|
2012-02-27 01:29:56 +01:00
|
|
|
JSON data that can be useful for inventory purposes.
|
2012-02-27 00:52:42 +01:00
|
|
|
|
|
|
|
Requires that 'facter' and 'ruby-json' be installed on the remote end.
|
|
|
|
|
2012-02-27 02:42:13 +01:00
|
|
|
This module is informative only - it takes no parameters & does not support change hooks,
|
2012-02-27 01:29:56 +01:00
|
|
|
nor does it make any changes on the system.
|
|
|
|
|
|
|
|
|
|
|
|
file
|
|
|
|
----
|
|
|
|
|
|
|
|
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.
|
2012-02-27 00:52:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
git
|
|
|
|
---
|
|
|
|
|
|
|
|
Deploys software from git checkouts.
|
|
|
|
|
|
|
|
This module is in plan.
|
|
|
|
|
|
|
|
|
|
|
|
ohai
|
|
|
|
----
|
|
|
|
|
2012-02-27 02:42:13 +01:00
|
|
|
Similar to the facter module, this returns JSON inventory data. Ohai
|
|
|
|
data is a bit more verbose and nested than facter.
|
2012-02-27 00:52:42 +01:00
|
|
|
|
|
|
|
Requires that 'ohai' be installed on the remote end.
|
|
|
|
|
2012-02-27 02:42:13 +01:00
|
|
|
This module is information only - it takes no parameters & does not
|
|
|
|
support change hooks, nor does it make any changes on the system.
|
2012-02-27 00:52:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
ping
|
|
|
|
----
|
|
|
|
|
|
|
|
A trivial test module, this module always returns the integer '1' on
|
2012-02-27 01:29:56 +01:00
|
|
|
successful contact.
|
2012-02-27 00:52:42 +01:00
|
|
|
|
|
|
|
This module does not support change hooks.
|
|
|
|
|
2012-02-27 02:42:13 +01:00
|
|
|
This module is informative only - it takes no parameters & does not
|
|
|
|
support change hooks, nor does it make any changes on the system.
|
2012-02-27 01:29:56 +01:00
|
|
|
|
2012-02-27 00:52:42 +01:00
|
|
|
|
|
|
|
service
|
|
|
|
-------
|
|
|
|
|
|
|
|
Controls services on remote machines.
|
|
|
|
|
2012-02-27 04:31:42 +01:00
|
|
|
*state=*::
|
2012-02-27 00:52:42 +01:00
|
|
|
|
|
|
|
Values are 'started', 'stopped', or 'restarted'. Started/stopped
|
|
|
|
are idempotent actions that will not run commands unless neccessary.
|
|
|
|
'restarted' will always bounce the service
|
|
|
|
|
|
|
|
|
|
|
|
*name=*::
|
|
|
|
|
|
|
|
The name of the service
|
|
|
|
|
|
|
|
|
|
|
|
setup
|
|
|
|
-----
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
*metadata=*::
|
|
|
|
|
|
|
|
Optionally overrides the default JSON file location of /etc/ansible/setup.
|
2012-02-27 01:21:44 +01:00
|
|
|
If used, also supply the metadata parameter to 'template'. Change if
|
|
|
|
running as a non-root remote user who does not have permissions on /etc/ansible.
|
2012-02-27 00:52:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
template
|
|
|
|
--------
|
|
|
|
|
|
|
|
Templates a file out to a remote server. Call the setup module prior to usage.
|
|
|
|
|
|
|
|
*src=*::
|
|
|
|
|
|
|
|
path of a Jinja2 formatted template on the local server
|
|
|
|
|
|
|
|
|
|
|
|
*dest*::
|
|
|
|
|
|
|
|
location to render the template on the remote server
|
|
|
|
|
|
|
|
|
|
|
|
*metadata*::
|
|
|
|
|
|
|
|
location of a JSON file to use to supply template data. Default is /etc/ansible/setup
|
2012-02-27 01:21:44 +01:00
|
|
|
which is the same as the default for the setup module. Change if running as a non-root
|
|
|
|
remote user who does not have permissions on /etc/ansible.
|
2012-02-27 00:52:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
This module also returns md5sum information about the resultant file.
|
|
|
|
|
|
|
|
|
|
|
|
user
|
|
|
|
----
|
|
|
|
|
|
|
|
This module is in plan.
|
|
|
|
|
|
|
|
|
|
|
|
yum
|
|
|
|
---
|
|
|
|
|
|
|
|
This module is in plan.
|
|
|
|
|
|
|
|
|
|
|
|
WRITING YOUR OWN MODULES
|
|
|
|
------------------------
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
AUTHOR
|
|
|
|
------
|
|
|
|
|
|
|
|
Ansible was originally written by Michael DeHaan. See the AUTHORS file
|
|
|
|
for a complete list of contributors.
|
|
|
|
|
|
|
|
SEE ALSO
|
|
|
|
--------
|
|
|
|
|
2012-02-27 03:03:18 +01:00
|
|
|
*ansible*(1)
|
2012-02-27 00:52:42 +01:00
|
|
|
|
2012-02-27 03:03:18 +01:00
|
|
|
*ansible-playbook*(5) - pending
|
2012-02-27 00:52:42 +01:00
|
|
|
|
|
|
|
Ansible home page: <https://github.com/mpdehaan/ansible/>
|