2

CentOS で ansible 2.4 を使用しており、リモート サーバーで以下のスクリプトを実行して出力を取得しようとしています。ここでの問題は、yum info 出力が json 形式でも表示されていることです。しかし、出力のみを表示する必要があります。json 形式を削除する方法。

---

- hosts: GeneralServer

  tasks:
  - name: Checking the service status
    shell: systemctl status {{ item }}
    with_items:
        - httpd
        - crond
        - postfix
        - sshd
    register: service
  - debug: var=service
  - name: Checking the package info
    shell : yum info {{ item }}
    with_items:
        - httpd
        - postfix
    register: info
  - debug: var=info
  - name: Executing the mysql running scripts in mysql
    shell: mysql -u username --password mysql -Ns -e 'show databases;'
    register: databases
  - debug: var=databases 

また、私はコールバック モジュールが初めてです。この問題を解決するのを手伝ってください。

stdout_lines の値のみを表示することは可能ですか。

4

1 に答える 1