From Trivial Treeshrew, 2 Weeks ago, written in JavaScript.
  1. {
  2.         "job_template": {
  3.           "name": "Ansible Roles - Ansible Default with env.* parameters",
  4.           "job_category": "Ansible Playbook",
  5.           "template": "---
  6.      - hosts: all
  7.        tasks:
  8.          - name: Display all parameters known for the Foreman host
  9.            debug:
  10.              var: foreman_params
  11.        roles:
  12.      <%- if @host.all_ansible_roles.present? -%>
  13.      <%=   @host.all_ansible_roles.map { |role| "    - #{role.name.strip}" }.join("n") %>
  14.      <%- end -%>
  15.        environment:
  16.      <% host_enc['parameters'].each do |param| -%>
  17.        <%- if param[0].start_with?('env.') -%>
  18.          - <%= param[0][4..-1] %>: <%= param[1] %>
  19.        <%- end -%>
  20.      <% end -%>",
  21.           "provider_type": "Ansible",
  22.           "locations": [3],
  23.           "organizations": [4]
  24.         }
  25.       }
captcha