2장. Automation Services Catalog와의 통합을 지원하도록 플레이북 set_stats 필드 업데이트

플레이북을 업데이트하여 주문 프로세스 워크플로에서 Automation Services Catalog에 정보를 전달하고 제품 전체에 대체 가능한 변수를 지원할 수 있습니다.

2.1. Automation Services Catalog에 값을 반환하는 플레이북 작성

Automation Services Catalog에 값을 반환하도록 설계된 플레이북을 작성할 수 있습니다. expose_to _ cloud_redhat_com_ 을 접두사로 지정하면 해당 값을 Automation Services Catalog로 반환합니다. 그런 다음 대체 가능한 변수를 사용하여 해당 값을 추가 플레이북을 통해 전달할 수 있습니다.

아래 플레이북 예제를 사용하여 set_stats 값에 대해 알아보고 값을 Automation Services Catalog에 다시 전달하고 순서 프로세스에서 후속 플레이북에서 대체 값으로 사용합니다.

플레이북 주문하기 전 예

전에 플레이북이 즐겨 찾는 색상의 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"

제품 순서 플레이북의 예

이 플레이북은 대체 값을 다시 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}}"

플레이북 주문 후 예

아래 주문 후 플레이북 예제에는 제품 플레이북에서 전달한 artifact 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}}"
~