Skip to content
Ricky
Chinese

搜尋

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

將指令輸出轉為圖片

  • 則言
  • 1 分鐘
---
- 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

    # 可以使用 ImageMagick 來轉換文字為圖片
    - 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