ansible / ansible.builtin / v2.5.11 / lookup / lines read lines from command | "added in version" 0.9 of ansible.builtin" Authors: Daniel Hokka Zakrisson <daniel@hozac.com>ansible.builtin.lines (v2.5.11) — lookup
pip
Install with pip install ansible==2.5.11
Run a commandi or more and split the output into lines returning them as a list
- name: we could use file direclty, but this shows output from command debug: msg="{{ item }} is a line running cat on /etc/motd" with_lines: cat /etc/motd
- name: More useful example of looping over a command result 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