Document standardized task/handler include syntax.

This commit is contained in:
Michael DeHaan 2013-10-12 10:57:11 -04:00
parent 6bec262b8e
commit f27a9986c1
2 changed files with 8 additions and 4 deletions

View file

@ -6,16 +6,15 @@ Ansible Changes By Release
Highlighted new features: Highlighted new features:
* Added do-until feature, which can be used to retry a failed task a specified number of times with a delay in-between the retries. * Added do-until feature, which can be used to retry a failed task a specified number of times with a delay in-between the retries.
* (docs pending) Added failed_when option for tasks, which can be used to specify logical statements that make it easier to determine when a task has failed, or to make it easier to ignore certain non-zero return codes for some commands. * Added failed_when option for tasks, which can be used to specify logical statements that make it easier to determine when a task has failed, or to make it easier to ignore certain non-zero return codes for some commands.
* Added the "subelement" lookup plugin, which allows iteration of the keys of a dictionary or items in a list. * Added the "subelement" lookup plugin, which allows iteration of the keys of a dictionary or items in a list.
* Added the capability to use either paramiko or ssh for the inital setup connection of an accelerated playbook. * Added the capability to use either paramiko or ssh for the inital setup connection of an accelerated playbook.
* (docs pending) Swap the active user on a task in the middle of a play with the 'remote_user' parameter.
* Automatically provide advice on common parser errors users encounter. * Automatically provide advice on common parser errors users encounter.
* Deprecation warnings are now shown for legacy features: when_integer/etc, only_if, include+with_items, etc. Can be disabled in ansible.cfg * Deprecation warnings are now shown for legacy features: when_integer/etc, only_if, include+with_items, etc. Can be disabled in ansible.cfg
* The system will now provide helpful tips around possible YAML syntax errors increasing ease of use for new users. * The system will now provide helpful tips around possible YAML syntax errors increasing ease of use for new users.
* warnings are now shown for using {{ foo }} in loops and conditionals, and suggest leaving the variable expressions bare as per docs. * warnings are now shown for using {{ foo }} in loops and conditionals, and suggest leaving the variable expressions bare as per docs.
* The roles search path is now configurable in ansible.cfg. 'roles_path' in the config setting. * The roles search path is now configurable in ansible.cfg. 'roles_path' in the config setting.
* (DOCS PENDING) includes with parameters can now be done like roles for consistency: - { include: song.yml, year:1984, song:'jump' } * Includes with parameters can now be done like roles for consistency: - { include: song.yml, year:1984, song:'jump' }
* The name of each role is now shown before each task if roles are being used * The name of each role is now shown before each task if roles are being used
New modules and plugins: New modules and plugins:

View file

@ -63,7 +63,12 @@ contain all of my wordpress tasks in a single wordpress.yml file, and use it lik
- include: wordpress.yml user=alice - include: wordpress.yml user=alice
- include: wordpress.yml user=bob - include: wordpress.yml user=bob
Variables passed in can then be used in the included files. We've already covered them a bit in :doc:`playbooks_variables`. If you are running Ansible 1.4 and later, include syntax is streamlined to match roles, and also allows passing list and dictionary parameters::
tasks:
- { include: wordpress.yml, user: timmy, ssh_keys: [ 'keys/one.txt', 'keys/two.txt' ] }
Using either syntax, variables passed in can then be used in the included files. We've already covered them a bit in :doc:`playbooks_variables`.
You can reference them like this:: You can reference them like this::
{{ user }} {{ user }}