Skip to content

Commit

Permalink
Merge pull request ansible#1 from ansible/devel
Browse files Browse the repository at this point in the history
update from origin
  • Loading branch information
yfix committed Oct 8, 2015
2 parents a2422bf + ae69409 commit cf7763a
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ New Modules:
* amazon: s3_lifecycle
* amazon: s3_logging
* apk
* bigip_gtm_wide_ip
* bundler
* centurylink: clc_blueprint_package
* centurylink: clc_firewall_policy
Expand Down Expand Up @@ -155,7 +156,9 @@ New Modules:
* openstack: os_client_config
* openstack: os_floating_ip
* openstack: os_image
* openstack: os_image_facts
* openstack: os_network
* openstack: os_network_facts
* openstack: os_nova_flavor
* openstack: os_object
* openstack: os_router
Expand Down Expand Up @@ -285,6 +288,7 @@ you avoid ever writing sensitive plaintext to disk.
* ansible-vault rekey accepts the --new-vault-password-file option.
* Configuration items defined as paths (local only) now all support shell style interpolations.
* Many fixes and new options added to modules, too many to list here.
* Now you can see task file and line number when using verbosity of 3 or above.

## 1.9.2 "Dancing In the Street" - Jun 26, 2015

Expand Down
2 changes: 1 addition & 1 deletion docsite/rst/developing_modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ Windows modules checklist
* Favour native powershell and .net ways of doing things over calls to COM libraries or calls to native executables which may or may not be present in all versions of windows
* modules are in powershell (.ps1 files) but the docs reside in same name python file (.py)
* look at ansible/lib/ansible/module_utils/powershell.ps1 for common code, avoid duplication
* Ansible uses strictmode so be sure to test with that enabled
* Ansible uses strictmode version 2.0 so be sure to test with that enabled
* start with::

#!powershell
Expand Down
1 change: 0 additions & 1 deletion docsite/rst/playbooks_blocks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ privilege escalation for all the enclosed tasks.
Error Handling
``````````````

About Blocks
Blocks also introduce the ability to handle errors in a way similar to exceptions in most programming languages.

.. code-block:: YAML
Expand Down
7 changes: 7 additions & 0 deletions docsite/rst/playbooks_filters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -527,11 +527,18 @@ To escape special characters within a regex, use the "regex_escape" filter::

# convert '^f.*o(.*)$' to '\^f\.\*o\(\.\*\)\$'
{{ '^f.*o(.*)$' | regex_escape() }}
To make use of one attribute from each item in a list of complex variables, use the "map" filter (see the `Jinja2 map() docs`_ for more)::

# get a comma-separated list of the mount points (e.g. "/,/mnt/stuff") on a host
{{ ansible_mounts|map(attribute='mount')|join(',') }}

A few useful filters are typically added with each new Ansible release. The development documentation shows
how to extend Ansible filters by writing your own as plugins, though in general, we encourage new ones
to be added to core so everyone can make use of them.

.. _Jinja2 map() docs: http://jinja.pocoo.org/docs/dev/templates/#map

.. _builtin filters: http://jinja.pocoo.org/docs/templates/#builtin-filters

.. seealso::
Expand Down
3 changes: 3 additions & 0 deletions docsite/rst/playbooks_lookups.rst
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ default empty string return value if the key is not in the ini file

The Credstash Lookup
````````````````````
.. versionadded:: 2.0

Credstash is a small utility for managing secrets using AWS's KMS and DynamoDB: https://github.com/LuminalOSS/credstash

Expand Down Expand Up @@ -233,7 +234,9 @@ You can specify regions or tables to fetch secrets from::
- name: "Test credstash lookup plugin -- get the company's github password"
debug: msg="Credstash lookup! {{ lookup('credstash', 'company-github-password', table='company-passwords') }}"

If you're not using 2.0 yet, you can do something similar with the credstash tool and the pipe lookup (see below)::

debug: msg="Poor man's credstash lookup! {{ lookup('pipe', 'credstash -r us-west-1 get my-other-password') }}"

.. _more_lookups:

Expand Down
6 changes: 3 additions & 3 deletions lib/ansible/cli/galaxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ def execute_init(self):
force = self.get_opt('force', False)
offline = self.get_opt('offline', False)

role_name = self.args.pop(0).strip()
if role_name == "":
role_name = self.args.pop(0).strip() if self.args else None
if not role_name:
raise AnsibleOptionsError("- no role name specified for init")
role_path = os.path.join(init_path, role_name)
if os.path.exists(role_path):
Expand Down Expand Up @@ -347,7 +347,7 @@ def execute_install(self):

# install dependencies, if we want them
if not no_deps and installed:
role_dependencies = role.metadata.get('dependencies', [])
role_dependencies = role.metadata.get('dependencies') or []
for dep in role_dependencies:
self.display.debug('Installing dep %s' % dep)
dep_req = RoleRequirement()
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/module_utils/powershell.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

Set-StrictMode -Version Latest
Set-StrictMode -Version 2.0

# Ansible v2 will insert the module arguments below as a string containing
# JSON; assign them to an environment variable and redefine $args so existing
Expand Down
6 changes: 6 additions & 0 deletions lib/ansible/playbook/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ def __init__(self, block=None, role=None, task_include=None):

super(Task, self).__init__()

def get_path(self):
''' return the absolute path of the task with its line number '''

if hasattr(self, '_ds'):
return "%s:%s" % (self._ds._data_source, self._ds._line_number)

def get_name(self):
''' return the name of the task '''

Expand Down
4 changes: 4 additions & 0 deletions lib/ansible/plugins/callback/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ def v2_playbook_on_no_hosts_remaining(self):

def v2_playbook_on_task_start(self, task, is_conditional):
self._display.banner("TASK [%s]" % task.get_name().strip())
if self._display.verbosity > 3:
path = task.get_path()
if path:
self._display.display("task path: %s" % path, color='dark gray')

def v2_playbook_on_cleanup_task_start(self, task):
self._display.banner("CLEANUP TASK [%s]" % task.get_name().strip())
Expand Down
29 changes: 29 additions & 0 deletions lib/ansible/utils/module_docs_fragments/ec2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# (c) 2015, Ansible, Inc
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.


class ModuleDocFragment(object):

# EC2 only documentation fragment
DOCUMENTATION = """
options:
region:
description:
- The AWS region to use. If not specified then the value of the AWS_REGION or EC2_REGION environment variable, if any, is used. See U(http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region)
required: false
aliases: [ 'aws_region', 'ec2_region' ]
"""

0 comments on commit cf7763a

Please sign in to comment.