ansible.builtin.pipe (v2.16.5) — lookup

read output from a command

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

Authors: Daniel Hokka Zakrisson (!UNKNOWN) <daniel@hozac.com>

Install Ansible via pip

Install with pip install ansible-core==2.16.5

Description

Run a command and return the output.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: raw result of running date command
  ansible.builtin.debug:
    msg: "{{ lookup('ansible.builtin.pipe', 'date') }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Always use quote filter to make sure your variables are safe to use with shell
  ansible.builtin.debug:
    msg: "{{ lookup('ansible.builtin.pipe', 'getent passwd ' + myuser | quote ) }}"

Inputs

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

Outputs

_string:
  description:
  - stdout from command
  elements: str
  type: list