From 78b5cd64d0a5d396063212e905cbd135b6a329ad Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Mon, 16 Apr 2012 23:45:15 -0400 Subject: [PATCH] Add pydoc for constructors. Some arguments can be trimmed as we plan to remove the need for them (like setup_cache and maybe module_vars) with various pending refactoring. --- lib/ansible/playbook.py | 18 ++++++++++++++++++ lib/ansible/runner.py | 26 +++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/lib/ansible/playbook.py b/lib/ansible/playbook.py index 781e598b08e..542e86a6300 100755 --- a/lib/ansible/playbook.py +++ b/lib/ansible/playbook.py @@ -66,6 +66,24 @@ class PlayBook(object): stats = None, sudo = False): + """ + playbook: path to a playbook file + host_list: path to a file like /etc/ansible/hosts + module_path: path to ansible modules, like /usr/share/ansible/ + forks: desired level of paralellism + timeout: connection timeout + remote_user: run as this user if not specified in a particular play + remote_pass: use this remote password (for all plays) vs using SSH keys + sudo_pass: if sudo==True, and a password is required, this is the sudo password + remote_port: default remote port to use if not specified with the host or play + transport: how to connect to hosts that don't specify a transport (local, paramiko, etc) + override_hosts: skip the inventory file, just talk to these hosts + callbacks output callbacks for the playbook + runner_callbacks: more callbacks, this time for the runner API + stats: holds aggregrate data about events occuring to each host + sudo: if not specified per play, requests all plays use sudo mode + """ + if playbook is None or callbacks is None or runner_callbacks is None or stats is None: raise Exception('missing required arguments') diff --git a/lib/ansible/runner.py b/lib/ansible/runner.py index 66105f0ee72..894800fc3cd 100755 --- a/lib/ansible/runner.py +++ b/lib/ansible/runner.py @@ -85,7 +85,6 @@ class Runner(object): setup_cache=None, transport=C.DEFAULT_TRANSPORT, conditional='True', - groups={}, callbacks=None, verbose=False, debug=False, @@ -93,6 +92,31 @@ class Runner(object): module_vars=None, is_playbook=False, inventory=None): + + """ + host_list : path to a host list file, like /etc/ansible/hosts + module_path : path to modules, like /usr/share/ansible + module_name : which module to run (string) + module_args : args to pass to the module (string) + forks : desired level of paralellism (hosts to run on at a time) + timeout : connection timeout, such as a SSH timeout, in seconds + pattern : pattern or groups to select from in inventory + remote_user : connect as this remote username + remote_pass : supply this password (if not using keys) + remote_port : use this default remote port (if not set by the inventory system) + sudo_pass : sudo password if using sudo and sudo requires a password + background : run asynchronously with a cap of this many # of seconds (if not 0) + basedir : paths used by modules if not absolute are relative to here + setup_cache : this is a internalism that is going away + transport : transport mode (paramiko, local) + conditional : only execute if this string, evaluated, is True + callbacks : output callback class + sudo : log in as remote user and immediately sudo to root + module_vars : provides additional variables to a template. FIXME: just use module_args, remove + is_playbook : indicates Runner is being used by a playbook. affects behavior in various ways. + inventory : inventory object, if host_list is not provided + """ + if setup_cache is None: setup_cache = {} if basedir is None: