Publish Ansible Variable to Mistral

Hello. Is it possible to publish ansible varibles to mistral? In my workflow, I use ansible.playbook action to get server status like CPU load, uptime, service status, etc then save them to ansible variables. What I need is to pass that variables to mistral. If it is possible, where I can found an example of that? I’ve searched about this but haven’t gotten anything. Thank you.

Hi @roboticpuppies. Welcome.

I’d recommend looking into accomplishing your use case with Orquesta since mitral will be deprecated soon. It’s recommended that all new workflows are created in Orquesta.

Orquesta — StackStorm 3.1.0 documentation

Hello. Does orquesta support Jinja expression? Here is an example of my code using Jinja and Mistral :

  action: ansible.playbook
    inventory_file: "{{ _.hostname }}"
    playbook: playbook/ansible.yaml
    private_key: "/root/.ssh/id_rsa"
    user: "root"
    env: '{"ANSIBLE_STDOUT_CALLBACK":"json"}'

I would like to use Jinja since I’m not familiar with YAQL. I’ve tried to use orquesta but I’m having difficulty when using YAQL.

Orquesta does support Jinja. Adding a link below. I’d recommend that you post what you have tried to do in Orquesta and we can try to help you from there.

Hello, sorry for the late reply. I tried to use orquesta. Here’s my example workflow :

version: '1.0'

description: Manage service on remote server using Ansible.
  - hostname
  - service_state
  - service_name

    action: ansible.playbook
      inventory_file: "{{ hostname }}," # <======= This should be from input
      playbook: playbook/playbook1.yaml
      cwd: "/opt/stackstorm/packs/test/actions/workflows"

How to pass variable from orquesta from input into that action?

Hi @roboticpuppies you should use:
"{{ ctx().hostname }}" instead of "{{ hostname }},".

Also - notice there is now quotes after }}