第2章 Automation Services Catalog との統合をサポートするための Playbook set_stats フィールドの更新

Playbook を更新して、Automation Services Catalog に情報を渡して、オーダープロセスワークフローの製品全体にわたる置換可能な変数をサポートすることができます。

2.1. 値を Automation Services Catalog に戻す Playbook の作成

値を Automation Services Catalog に戻すように設計された Playbook を作成できます。set_stats パラメーターの前に expose_to_cloud_redhat_com_ を加えると、その値が Automation Services Catalog に戻されます。次に、置換可能な変数を使用して、追加の Playbook でこれらの値を渡すことができます。

以下の Playbook の例を使用して set_stats の値について確認し、値を Automation Services Catalog に戻し、これをオーダープロセスの後続の Playbook の置換可能な値として使用します。

before order Playbook の例

この before order Playbook は、お気に入りの色を Automation Services Catalog set_stats 値に戻します。

# This playbook prints a simple debug message and set_stats
- name: Echo Hello, world!
  hosts: localhost
  gather_facts: yes
  tasks:
    - debug:
        msg: "Hello, world!"

    - set_stats:
        data:
          expose_to_cloud_redhat_com_favorite_color: "orange"

product order Playbook の例

この Playbook は、アーティファクトの値として Automation Services Catalog に置換可能な値を渡します。

# This playbook prints a simple debug message with given information
- name: Echo Hello, world!
  hosts: localhost
  gather_facts: yes
  tasks:
    - debug:
        msg: "Hello, {{favorite_color}} world!"

    - set_stats:
        data:
          expose_to_cloud_redhat_com_after_data: "{{favorite_color}}"

after order Playbook の例

以下の after order Playbook の例には、製品 Playbook によって渡されたアーティファクトの after_data 値が含まれます。

# This playbook prints a simple debug message with given information
- name: Echo Hello, world!
  hosts: localhost
  gather_facts: yes
  tasks:
    - debug:
        msg: "{{after_data}}"
~