Search

Chapter 2. Updating your playbook set_stats fields to support integration with Automation Services Catalog

download PDF

You can update your playbooks to pass information to Automation Services Catalog and support substitutable variables across the product in your order process workflow.

2.1. Writing playbook that return values to Automation Services Catalog

You can write playbooks designed to return values to Automation Services Catalog. Prefixing set_stats parameters with expose_to_cloud_redhat_com_ will return that value to Automation Services Catalog. You can then pass those values through additional playbooks using substitutable variables.

Use the playbook examples below to learn now about set_stats values and to pass values back to Automation Services Catalog and use them as substitutable values in subsequent playbooks in your order processes.

Example before order playbook

This before order playbook returns to Automation Services Catalog set_stats values for a favorite color:

# 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"

Example product order playbook

This playbook passes a substitutable value back to Automation Services Catalog as an artifact value.

# 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}}"

Example after order playbook

The after order playbook example below includes the artifact after_data value that was passed by the product playbook.

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

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.