Skip to content
Ricky
English

Search

Searching… No matching pages. Matching pages are listed below. Search is unavailable. Please try again.

Convert Command Output to an Image

  • Ricky Lin
  • 1 minute
---
- name: Capture command output and convert to image
  hosts: all

  tasks:
    - name: Display content of /etc/redhat-release
      shell: cat /etc/redhat-release
      register: redhat_release_result

    - name: hostname
      shell: hostname
      register: hostname_result

    # You can use ImageMagick to convert text to an image
    - name: Convert command output as image
      shell: echo -e "{{ hostname_result.stdout }}\n{{ redhat_release_result.stdout }}" | convert label:@- {{ hostname_result.stdout }}.png
      delegate_to: localhost