From a040807fd0c5f681ca6c7a8bfa271a8b14a675e2 Mon Sep 17 00:00:00 2001 From: Jan-Piet Mens Date: Sat, 29 Sep 2012 00:49:02 +0200 Subject: [PATCH] Module DOCUMENTATION for template, wait_for, and yum --- hacking/templates/man.j2 | 2 +- library/template | 41 ++++++++++++++++++++++++++++++++++++ library/wait_for | 45 ++++++++++++++++++++++++++++++++++++++++ library/yum | 34 ++++++++++++++++++++++++++++++ 4 files changed, 121 insertions(+), 1 deletion(-) diff --git a/hacking/templates/man.j2 b/hacking/templates/man.j2 index 61a967b4a00..47a960285c4 100644 --- a/hacking/templates/man.j2 +++ b/hacking/templates/man.j2 @@ -30,7 +30,7 @@ ." ." ." ------ NOTES -{% if notes is defined -%} +{% if notes -%} .SH NOTES {% for note in notes -%} .PP diff --git a/library/template b/library/template index 9132aeebbed..42039f0eca0 100755 --- a/library/template +++ b/library/template @@ -1 +1,42 @@ # this is a virtual module that is entirely implemented server side + + +DOCUMENTATION = ''' +--- +module: template +short_description: Templates a file out to a remote server. +description: + - Templates are processed by the Jinja2 templating language + (U(http://jinja.pocoo.org/docs/)) - documentation on the template + formatting can be found in the Template Designer Documentation + (U(http://jinja.pocoo.org/docs/templates/)). +options: + src: + description: + - Path of a Jinja2 formatted template on the local server. This can be a relative or absolute path. + required: true + default: null + aliases: [] + dest: + description: + - Location to render the template to on the remote machine. + required: true + default: null + backup: + description: + - Create a backup file including the timestamp information so you can get + the original file back if you somehow clobbered it incorrectly. + required: false + choices: [ "yes", "no" ] + default: "no" + others: + description: + - all arguments accepted by the M(file) module also work here + required: false +examples: + - code: template src=/mytemplates/foo.j2 dest=/etc/file.conf owner=bin group=wheel mode=0644 + description: "Example from Ansible Playbooks" +notes: [] +requirements: null +author: Michael DeHaan +''' diff --git a/library/wait_for b/library/wait_for index 1fc6e2b866e..5f0cbb0382f 100755 --- a/library/wait_for +++ b/library/wait_for @@ -23,6 +23,51 @@ import datetime import time import sys +DOCUMENTATION = ''' +--- +module: wait_for +short_description: Waits for a given port to become accessible on a server. +description: + - This is useful for when services are not immediately available after + their init scripts return - which is true of certain Java application + servers. It is also useful when starting guests with the M(virt) module and + needing to pause until they are ready. +version_added: "0.7" +options: + host: + description: + - hostname or IP address to wait for + required: false + default: "127.0.0.1" + aliases: [] + timeout: + description: + - maximum number of seconds to wait for + required: false + default: 300 + delay: + description: + - number of seconds to wait before starting to poll + required: false + default: 0 + port: + description: + - port number to poll + required: true + state: + description: + - either C(started), or C(stopped) depending on whether the module should + poll for the port being open or closed. + choices: [ "started", "stopped" ] + default: "started" +examples: + - code: wait_for port=8000 delay=10 + description: "Example from Ansible Playbooks" +notes: [] +requirements: null +author: Jeroen Hoekx +''' + def main(): module = AnsibleModule( diff --git a/library/yum b/library/yum index 20b7770c4ab..b63dfeb987a 100755 --- a/library/yum +++ b/library/yum @@ -25,6 +25,40 @@ import traceback import os import yum +DOCUMENTATION = ''' +--- +module: yum +short_description: Manages packages with the I(yum) package manager +description: + - Will install, upgrade, remove, and list packages with the I(yum) package manager. +options: + name: + description: + - package name, or package specifier with version, like C(name-1.0). + required: true + default: null + aliases: [] + list: + description: + - various non-idempotent commands for usage with C(/usr/bin/ansible) and I(not) playbooks. See examples. + required: false + default: null + state: + description: + - whether to install (C(present), C(latest)), or remove (C(absent)) a package. + required: false + choices: [ "present", "latest", "absent" ] + default: "present" +examples: + - code: yum name=httpd state=latest + - code: yum name=httpd state=removed + - code: yum name=httpd state=installed +notes: [] +# informational: requirements for nodes +requirements: [ yum, rpm ] +author: Seth Vidal +''' + def_qf = "%{name}-%{version}-%{release}.%{arch}" repoquery='/usr/bin/repoquery'