From f27a9986c19b5c63d3c6b75eeef2a7f2de6aed40 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Sat, 12 Oct 2013 10:57:11 -0400 Subject: [PATCH] Document standardized task/handler include syntax. --- CHANGELOG.md | 5 ++--- docsite/latest/rst/playbooks_roles.rst | 7 ++++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e467ea5c194..e2acb2e432c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,16 +6,15 @@ Ansible Changes By Release 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. -* (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 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. * 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. * 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. -* (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 New modules and plugins: diff --git a/docsite/latest/rst/playbooks_roles.rst b/docsite/latest/rst/playbooks_roles.rst index 4cdb07c7543..11e41ffd803 100644 --- a/docsite/latest/rst/playbooks_roles.rst +++ b/docsite/latest/rst/playbooks_roles.rst @@ -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=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:: {{ user }}