# coding: utf-8 # (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type DOCUMENTATION = """ lookup: debug author: Toshio Kuratomi (@abadger) version_added: "2.5" short_description: return contents of parameters description: - Returns the content of the parameters given options: _terms: description: strings to output prefix: description: A string to prefix to all of the terms. Defaults to empty string. type: string default: "" suffix: description: A string to suffix to all of the terms. Defaults to empty string. type: string default: "" """ EXAMPLES = """ - name: Echo a string on the remote machine command: "echo {{ item }}" loop: "{{ q('debug', 'Hello World') }}" - name: Display several debug messages command: "echo {{ item }}" loop: "{{ q('debug', ['Hello World', 'Olá Mundo']) }}' - name: Display several debug messages with a prefix command: "echo {{ item }}" loop: "{{ q('debug', ['Hello World', 'Olá Mundo'], prefix='Computer: \"', suffix='\"' }}" """ RETURN = """ _list: description: list of lines """ from ansible.errors import AnsibleError from ansible.module_utils.six.moves.urllib.error import HTTPError, URLError from ansible.module_utils._text import to_text from ansible.module_utils.urls import open_url, ConnectionError, SSLValidationError from ansible.plugins.lookup import LookupBase try: from __main__ import display except ImportError: from ansible.utils.display import Display display = Display() class LookupModule(LookupBase): def run(self, terms, variables=None, wantlist=True, prefix='', suffix=''): ret = [] for term in terms: ret.append(u'{0}{1}{2}'.format(prefix, term, suffix)) return ret