ansible / ansible.builtin / v2.16.5 / lookup / file read file contents | "added in version" 0.9 of ansible.builtin" Authors: Daniel Hokka Zakrisson (!UNKNOWN) <daniel@hozac.com>ansible.builtin.file (v2.16.5) — lookup
pip
Install with pip install ansible-core==2.16.5
This lookup returns the contents from a file on the Ansible controller's file system.
- ansible.builtin.debug: msg: "the value of foo.txt is {{ lookup('ansible.builtin.file', '/etc/foo.txt') }}"
- name: display multiple file contents ansible.builtin.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) elements: str type: list