* Fixup keyword dumping
* Clarify introductory text
* Turn links in the keyword description into seealso entries in the rst.
* Have plugin_formatter cleanup trailing whitespace
The indent filter in jinja2 < 2.10 indents blank lines by default which
leads to trailing whitespace. Cleanup after that filter.
* Edits
* Copy edit
| ... | ... |
@@ -50,7 +50,7 @@ docs/docsite/rst/modules_by_category.rst |
| 50 | 50 |
docs/docsite/rst/network_maintained.rst |
| 51 | 51 |
docs/docsite/rst/plugins_by_category.rst |
| 52 | 52 |
docs/docsite/rst/partner_maintained.rst |
| 53 |
-docs/docsite/rst/playbook_keywords.rst |
|
| 53 |
+docs/docsite/rst/playbooks_keywords.rst |
|
| 54 | 54 |
docs/docsite/rst/playbooks_directives.rst |
| 55 | 55 |
docs/docsite/rst/plugins/*/*.rst |
| 56 | 56 |
# deb building stuff... |
| ... | ... |
@@ -1,8 +1,11 @@ |
| 1 | 1 |
#!/usr/bin/env python |
| 2 | 2 |
|
| 3 | 3 |
import optparse |
| 4 |
-import yaml |
|
| 4 |
+import re |
|
| 5 |
+from distutils.version import LooseVersion |
|
| 5 | 6 |
|
| 7 |
+import jinja2 |
|
| 8 |
+import yaml |
|
| 6 | 9 |
from jinja2 import Environment, FileSystemLoader |
| 7 | 10 |
|
| 8 | 11 |
from ansible.playbook import Play |
| ... | ... |
@@ -18,7 +21,7 @@ class_list = [Play, Role, Block, Task] |
| 18 | 18 |
p = optparse.OptionParser( |
| 19 | 19 |
version='%prog 1.0', |
| 20 | 20 |
usage='usage: %prog [options]', |
| 21 |
- description='Generate module documentation from metadata', |
|
| 21 |
+ description='Generate playbook keyword documentation from code and descriptions', |
|
| 22 | 22 |
) |
| 23 | 23 |
p.add_option("-T", "--template-dir", action="store", dest="template_dir", default="../templates", help="directory containing Jinja2 templates")
|
| 24 | 24 |
p.add_option("-o", "--output-dir", action="store", dest="output_dir", default='/tmp/', help="Output directory for rst files")
|
| ... | ... |
@@ -66,5 +69,10 @@ template = env.get_template(template_file) |
| 66 | 66 |
outputname = options.output_dir + template_file.replace('.j2', '')
|
| 67 | 67 |
tempvars = {'oblist': oblist, 'clist': clist}
|
| 68 | 68 |
|
| 69 |
+keyword_page = template.render(tempvars) |
|
| 70 |
+if LooseVersion(jinja2.__version__) < LooseVersion('2.10'):
|
|
| 71 |
+ # jinja2 < 2.10's indent filter indents blank lines. Cleanup |
|
| 72 |
+ keyword_page = re.sub(' +\n', '\n', keyword_page)
|
|
| 73 |
+ |
|
| 69 | 74 |
with open(outputname, 'w') as f: |
| 70 |
- f.write(template.render(tempvars)) |
|
| 75 |
+ f.write(keyword_page) |
| ... | ... |
@@ -26,11 +26,13 @@ import datetime |
| 26 | 26 |
import glob |
| 27 | 27 |
import optparse |
| 28 | 28 |
import os |
| 29 |
-from pprint import PrettyPrinter |
|
| 30 | 29 |
import re |
| 31 | 30 |
import sys |
| 32 | 31 |
import warnings |
| 33 | 32 |
from collections import defaultdict |
| 33 |
+from distutils.version import LooseVersion |
|
| 34 |
+from pprint import PrettyPrinter |
|
| 35 |
+ |
|
| 34 | 36 |
try: |
| 35 | 37 |
from html import escape as html_escape |
| 36 | 38 |
except ImportError: |
| ... | ... |
@@ -40,6 +42,7 @@ except ImportError: |
| 40 | 40 |
def html_escape(text, quote=True): |
| 41 | 41 |
return cgi.escape(text, quote) |
| 42 | 42 |
|
| 43 |
+import jinja2 |
|
| 43 | 44 |
import yaml |
| 44 | 45 |
from jinja2 import Environment, FileSystemLoader |
| 45 | 46 |
from six import iteritems, string_types |
| ... | ... |
@@ -444,6 +447,10 @@ def process_plugins(module_map, templates, outputname, output_dir, ansible_versi |
| 444 | 444 |
display.v('about to template %s' % module)
|
| 445 | 445 |
display.vvvvv(pp.pformat(doc)) |
| 446 | 446 |
text = templates['plugin'].render(doc) |
| 447 |
+ if LooseVersion(jinja2.__version__) < LooseVersion('2.10'):
|
|
| 448 |
+ # jinja2 < 2.10's indent filter indents blank lines. Cleanup |
|
| 449 |
+ text = re.sub(' +\n', '\n', text)
|
|
| 450 |
+ |
|
| 447 | 451 |
write_data(text, output_dir, outputname, module) |
| 448 | 452 |
|
| 449 | 453 |
|
| ... | ... |
@@ -1,52 +1,68 @@ |
| 1 |
-accelerate: DEPRECATED, set to True to use accelerate connection plugin. |
|
| 2 |
-accelerate_ipv6: "DEPRECATED, set to True to force accelerate plugin to use ipv6 for it's connection." |
|
| 3 |
-accelerate_port: DEPRECATED, set to override default port use for accelerate connection. |
|
| 1 |
+accelerate: "*DEPRECATED*, set to True to use accelerate connection plugin." |
|
| 2 |
+accelerate_ipv6: "*DEPRECATED*, set to True to force accelerate plugin to use ipv6 for its connection." |
|
| 3 |
+accelerate_port: "*DEPRECATED*, set to override default port use for accelerate connection." |
|
| 4 | 4 |
action: "The 'action' to execute for a task, it normally translates into a C(module) or action plugin." |
| 5 |
-args: DEPRECATED, A secondary way to add arguments into a task, it takes a dictionary in which keys map to options and values .. well you get it. |
|
| 5 |
+args: "*DEPRECATED*, A secondary way to add arguments into a task. Takes a dictionary in which keys map to options and values." |
|
| 6 | 6 |
always: List of tasks, in a block, that execute no matter if there is an error in the block or not. |
| 7 |
-always_run: DEPRECATED, forces a task to run even in check mode, use :term:`check_mode` directive instead. |
|
| 7 |
+always_run: "*DEPRECATED*, forces a task to run even in check mode. Use :term:`check_mode` directive instead." |
|
| 8 | 8 |
any_errors_fatal: Force any un-handled task errors on any host to propagate to all hosts and end the play. |
| 9 | 9 |
async: Run a task asyncronouslly if the C(action) supports this. |
| 10 | 10 |
become: Boolean that controls if privilege escalation is used or not on :term:`Task` execution. |
| 11 | 11 |
become_flags: A string of flag(s) to pass to the privilege escalation program when :term:`become` is True. |
| 12 |
-become_method: Which method of privilege escalation to use. i.e. sudo/su/etc. |
|
| 13 |
-become_user: "User that you 'become' after using privilege escalation, the remote/login user must have permissions to become this user." |
|
| 12 |
+become_method: Which method of privilege escalation to use (such as sudo or su). |
|
| 13 |
+become_user: "User that you 'become' after using privilege escalation. The remote/login user must have permissions to become this user." |
|
| 14 | 14 |
block: List of tasks in a block. |
| 15 | 15 |
changed_when: "Conditional expression that overrides the task's normal 'changed' status." |
| 16 |
-check_mode: "A boolean that controls if a task is executed in 'check' mode" |
|
| 17 |
-connection: Allows you to change the connection plugin used for tasks to execute on the target. |
|
| 18 |
-delay: Number of seconds to delay between retries, this setting is only used in combination with :term:`until`. |
|
| 19 |
-delegate_facts: Boolean that allows you to apply facts to delegated host instead of inventory_hostname. |
|
| 20 |
-delegate_to: Host to execute task instead of the target (inventory_hostname), connection vars from the delegated host will also be used for the task. |
|
| 16 |
+check_mode: | |
|
| 17 |
+ A boolean that controls if a task is executed in 'check' mode |
|
| 18 |
+ |
|
| 19 |
+ .. seealso:: :ref:`check_mode_dry` |
|
| 20 |
+ |
|
| 21 |
+connection: | |
|
| 22 |
+ Allows you to change the connection plugin used for tasks to execute on the target. |
|
| 23 |
+ |
|
| 24 |
+ .. seealso:: :ref:`using_connection` |
|
| 25 |
+ |
|
| 26 |
+delay: Number of seconds to delay between retries. This setting is only used in combination with :term:`until`. |
|
| 27 |
+delegate_facts: Boolean that allows you to apply facts to a delegated host instead of inventory_hostname. |
|
| 28 |
+delegate_to: Host to execute task instead of the target (inventory_hostname). Connection vars from the delegated host will also be used for the task. |
|
| 21 | 29 |
diff: "Toggle to make tasks return 'diff' information or not." |
| 22 | 30 |
environment: A dictionary that gets converted into environment vars to be provided for the task upon execution. |
| 23 | 31 |
fact_path: Set the fact path option for the fact gathering plugin controlled by :term:`gather_facts`. |
| 24 | 32 |
failed_when: "Conditional expression that overrides the task's normal 'failed' status." |
| 25 |
-force_handlers: Will force notified handler execution for hosts even if they failed during the play, it will not trigger if the play itself fails. |
|
| 33 |
+force_handlers: Will force notified handler execution for hosts even if they failed during the play. Will not trigger if the play itself fails. |
|
| 26 | 34 |
gather_facts: "A boolean that controls if the play will automatically run the 'setup' task to gather facts for the hosts." |
| 27 | 35 |
gather_subset: Allows you to pass subset options to the fact gathering plugin controlled by :term:`gather_facts`. |
| 28 | 36 |
gather_timeout: Allows you to set the timeout for the fact gathering plugin controlled by :term:`gather_facts`. |
| 29 |
-handlers: "A section with tasks that are treated as handlers, these won't get executed normally, only when notified. After each section of tasks is complete." |
|
| 37 |
+handlers: "A section with tasks that are treated as handlers, these won't get executed normally, only when notified after each section of tasks is complete." |
|
| 30 | 38 |
hosts: "A list of groups, hosts or host pattern that translates into a list of hosts that are the play's target." |
| 31 | 39 |
ignore_errors: Boolean that allows you to ignore task failures and continue with play. It does not affect connection errors. |
| 32 | 40 |
loop: "Takes a list for the task to iterate over, saving each list element into the ``item`` variable (configurable via loop_control)" |
| 33 |
-loop_control: "Several keys here allow you to modify/set loop behaviour in a task see http://docs.ansible.com/ansible/latest/playbooks_loops.html#loop-control for details." |
|
| 41 |
+loop_control: | |
|
| 42 |
+ Several keys here allow you to modify/set loop behaviour in a task. |
|
| 43 |
+ |
|
| 44 |
+ .. seealso:: :ref:`loop_control` |
|
| 45 |
+ |
|
| 34 | 46 |
max_fail_percentage: can be used to abort the run after a given percentage of hosts in the current batch has failed. |
| 35 |
-name: "It's a name, works mostly for documentation, in the case of tasks/handlers it can be an identifier." |
|
| 47 |
+name: "Identifier. Can be used for documentation, in or tasks/handlers." |
|
| 36 | 48 |
no_log: Boolean that controls information disclosure. |
| 37 |
-notify: "list of handlers to notify when the task returns a 'changed=True' status." |
|
| 49 |
+notify: "List of handlers to notify when the task returns a 'changed=True' status." |
|
| 38 | 50 |
order: Controls the sorting of hosts as they are used for executing the play. Possible values are inventory (default), sorted, reverse_sorted, reverse_inventory and shuffle. |
| 39 | 51 |
poll: Sets the polling interval in seconds for async tasks (default 10s). |
| 40 | 52 |
port: Used to override the default port used in a connection. |
| 41 | 53 |
post_tasks: A list of tasks to execute after the :term:`tasks` section. |
| 42 | 54 |
pre_tasks: A list of tasks to execute before :term:`roles`. |
| 43 |
-remote_user: User used to log into the target via the connection plugin. AKA login user. |
|
| 55 |
+remote_user: User used to log into the target via the connection plugin. |
|
| 44 | 56 |
register: Name of variable that will contain task status and module return data. |
| 45 | 57 |
rescue: List of tasks in a :term:`block` that run if there is a task error in the main :term:`block` list. |
| 46 | 58 |
retries: "Number of retries before giving up in a :term:`until` loop. This setting is only used in combination with :term:`until`." |
| 47 | 59 |
roles: List of roles to be imported into the play |
| 48 | 60 |
run_once: Boolean that will bypass the host loop, forcing the task to execute on the first host available and will also apply any facts to all active hosts. |
| 49 |
-serial: Defines the 'batch' of hosts to execute the current play until the end. |
|
| 61 |
+serial: | |
|
| 62 |
+ Explicitly define how Ansible batches the execution of the current play on the play's target |
|
| 63 |
+ |
|
| 64 |
+ .. seealso:: :ref:`rolling_update_batch_size` |
|
| 65 |
+ |
|
| 50 | 66 |
strategy: Allows you to choose the connection plugin to use for the play. |
| 51 | 67 |
tags: Tags applied to the task or included tasks, this allows selecting subsets of tasks from the command line. |
| 52 | 68 |
tasks: Main list of tasks to execute in the play, they run after :term:`roles` and before :term:`post_tasks`. |
| ... | ... |
@@ -1,11 +1,16 @@ |
| 1 |
-Directives Glossary |
|
| 2 |
-=================== |
|
| 1 |
+Playbook Keywords |
|
| 2 |
+================= |
|
| 3 | 3 |
|
| 4 |
-Here we list the common playbook objects and their directives. |
|
| 5 |
-Note that not all directives affect the object itself and might just be there to be inherited by other contained objects. |
|
| 6 |
-Aliases for the directives are not reflected here, nor are mutable ones, for example `action` in task can be substituted by the name of any module plugin. |
|
| 4 |
+These are the keywords available on common playbook objects. |
|
| 5 |
+ |
|
| 6 |
+.. note:: Please note: |
|
| 7 |
+ |
|
| 8 |
+ * Aliases for the directives are not reflected here, nor are mutable one. For example, |
|
| 9 |
+ :term:`action` in task can be substituted by the name of any Ansible module. |
|
| 10 |
+ * The keywords do not have ``version_added`` information at this time |
|
| 11 |
+ * Some keywords set defaults for the objects inside of them rather than for the objects |
|
| 12 |
+ themselves |
|
| 7 | 13 |
|
| 8 |
-Be aware that this reflects the 'current development branch' and that the keywords do not have 'version_added' information. |
|
| 9 | 14 |
|
| 10 | 15 |
.. contents:: |
| 11 | 16 |
:local: |
| ... | ... |
@@ -19,8 +24,7 @@ Be aware that this reflects the 'current development branch' and that the keywor |
| 19 | 19 |
|
| 20 | 20 |
{% for attribute in oblist[name]|sort %}
|
| 21 | 21 |
{{ attribute }}
|
| 22 |
- {{ oblist[name][attribute] }}
|
|
| 22 |
+ {{ oblist[name][attribute] |indent(8) }}
|
|
| 23 | 23 |
|
| 24 | 24 |
{% endfor %}
|
| 25 |
- |
|
| 26 | 25 |
{% endfor %}
|