diff options
Diffstat (limited to 'lib/ansible/plugins/lookup/csvfile.py')
-rw-r--r-- | lib/ansible/plugins/lookup/csvfile.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/ansible/plugins/lookup/csvfile.py b/lib/ansible/plugins/lookup/csvfile.py index 5932d77c..76d97ed4 100644 --- a/lib/ansible/plugins/lookup/csvfile.py +++ b/lib/ansible/plugins/lookup/csvfile.py @@ -12,7 +12,7 @@ DOCUMENTATION = r""" description: - The csvfile lookup reads the contents of a file in CSV (comma-separated value) format. The lookup looks for the row where the first column matches keyname (which can be multiple words) - and returns the value in the C(col) column (default 1, which indexed from 0 means the second column in the file). + and returns the value in the O(col) column (default 1, which indexed from 0 means the second column in the file). options: col: description: column to return (0 indexed). @@ -20,7 +20,7 @@ DOCUMENTATION = r""" default: description: what to return if the value is not found in the file. delimiter: - description: field separator in the file, for a tab you can specify C(TAB) or C(\t). + description: field separator in the file, for a tab you can specify V(TAB) or V(\\t). default: TAB file: description: name of the CSV/TSV file to open. @@ -35,6 +35,9 @@ DOCUMENTATION = r""" - For historical reasons, in the search keyname, quotes are treated literally and cannot be used around the string unless they appear (escaped as required) in the first column of the file you are parsing. + seealso: + - ref: playbook_task_paths + description: Search paths used for relative files. """ EXAMPLES = """ @@ -54,7 +57,7 @@ EXAMPLES = """ neighbor_as: "{{ csvline[5] }}" neigh_int_ip: "{{ csvline[6] }}" vars: - csvline = "{{ lookup('ansible.builtin.csvfile', bgp_neighbor_ip, file='bgp_neighbors.csv', delimiter=',') }}" + csvline: "{{ lookup('ansible.builtin.csvfile', bgp_neighbor_ip, file='bgp_neighbors.csv', delimiter=',') }}" delegate_to: localhost """ @@ -75,7 +78,7 @@ from ansible.errors import AnsibleError, AnsibleAssertionError from ansible.parsing.splitter import parse_kv from ansible.plugins.lookup import LookupBase from ansible.module_utils.six import PY2 -from ansible.module_utils._text import to_bytes, to_native, to_text +from ansible.module_utils.common.text.converters import to_bytes, to_native, to_text class CSVRecoder: |