ansible / ansible.builtin / v2.5.15 / lookup / file read file contents | "added in version" 0.9 of ansible.builtin" Authors: Daniel Hokka Zakrisson <daniel@hozac.com>ansible.builtin.file (v2.5.15) — lookup
pip
Install with pip install ansible==2.5.15
This lookup returns the contents from a file on the Ansible controller's file system.
- debug: msg="the value of foo.txt is {{lookup('file', '/etc/foo.txt') }}"
- name: display multiple file contents debug: var=item with_file: - "/path/to/foo.txt" - "bar.txt" # will be looked in files/ dir relative to play or in role - "/path/to/biz.txt"
_terms: description: path(s) of files to read required: true lstrip: default: false description: whether or not to remove whitespace from the beginning of the looked-up file required: false type: bool rstrip: default: true description: whether or not to remove whitespace from the ending of the looked-up file required: false type: bool
_raw: description: - content of file(s)