2012-02-27 00:52:42 +01:00
|
|
|
ansible-modules(5)
|
|
|
|
=================
|
|
|
|
:doctype:manpage
|
|
|
|
:man source: Ansible-modules
|
|
|
|
:man version: 0.0.1
|
2012-03-05 22:06:02 +01:00
|
|
|
:man manual: Ansible
|
2012-02-27 00:52:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
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
|
2012-03-05 22:06:02 +01:00
|
|
|
trigger change events, as described in *ansible-playbooks*(5).
|
2012-02-28 04:43:08 +01:00
|
|
|
|
|
|
|
Unless otherwise noted, all modules support change hooks.
|
2012-02-27 00:52:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
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-28 04:43:08 +01:00
|
|
|
(Async command running and command execution time limits are in plan.)
|
2012-02-27 00:52:42 +01:00
|
|
|
|
|
|
|
copy
|
|
|
|
----
|
|
|
|
|
2012-02-28 04:43:08 +01:00
|
|
|
The copy module moves a file on the local box to remote locations.
|
2012-02-27 00:52:42 +01:00
|
|
|
|
|
|
|
*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.
|
|
|
|
|
2012-02-28 04:43:08 +01:00
|
|
|
*repo=*::
|
|
|
|
|
|
|
|
git or http protocol address of the repo to checkout
|
|
|
|
|
|
|
|
*dest=*::
|
|
|
|
|
|
|
|
where to check it out, an absolute directory path
|
|
|
|
|
|
|
|
*version=*::
|
|
|
|
|
|
|
|
what version to check out -- either the git SHA, the literal string 'HEAD', or a tag name
|
2012-02-27 00:52:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
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
|
2012-03-05 22:06:02 +01:00
|
|
|
first step in your playbook.
|
2012-02-27 00:52:42 +01:00
|
|
|
|
2012-02-28 05:18:53 +01:00
|
|
|
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.
|
|
|
|
|
2012-02-27 00:52:42 +01:00
|
|
|
*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
|
|
|
|
2012-02-28 04:43:08 +01:00
|
|
|
*anything=*::
|
|
|
|
|
|
|
|
any other parameters can be named basically anything, and set a key=value
|
|
|
|
pair in the JSON file for use in templating.
|
|
|
|
|
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.
|
|
|
|
|
2012-03-05 22:06:02 +01:00
|
|
|
|
|
|
|
ENVIRONMENT
|
|
|
|
-----------
|
|
|
|
|
|
|
|
ANSIBLE_LIBRARY -- Override the default ansible module library path
|
|
|
|
|
|
|
|
|
2012-02-27 00:52:42 +01:00
|
|
|
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-28 05:39:47 +01:00
|
|
|
*ansible-playbook*(5)
|
2012-02-27 00:52:42 +01:00
|
|
|
|
|
|
|
Ansible home page: <https://github.com/mpdehaan/ansible/>
|