ansible / ansible.builtin / v2.15.10 / lookup / lines read lines from command | "added in version" 0.9 of ansible.builtin" Authors: Daniel Hokka Zakrisson (!UNKNOWN) <daniel@hozac.com>ansible.builtin.lines (v2.15.10) — lookup
pip
Install with pip install ansible-core==2.15.10
Run one or more commands and split the output into lines, returning them as a list
- name: We could read the file directly, but this shows output from command ansible.builtin.debug: msg="{{ item }} is an output line from running cat on /etc/motd" with_lines: cat /etc/motd
- name: More useful example of looping over a command result ansible.builtin.shell: "/usr/bin/frobnicate {{ item }}" with_lines: - "/usr/bin/frobnications_per_host --param {{ inventory_hostname }}"
_terms: description: command(s) to run required: true
_list: description: - lines of stdout from command elements: str type: list