ansible.builtin.lines (v2.4.6.0-1) — lookup

read lines from command

| "added in version" 0.9 of ansible.builtin"

Authors: Daniel Hokka Zakrisson <daniel@hozac.com>

Install Ansible via pip

Install with pip install ansible==2.4.6.0.post1

Description

Run a commandi or more and split the output into lines returning them as a list

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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 }}"

Inputs

    
_terms:
    description: command(s) to run
    required: true

Outputs

_list:
  description:
  - lines of stdout from command