DOC_INDEX
THEME
DOCS/Functions/render

render

Render Go templates to produce configuration files, reports, and text output

Available since v0.8.0.

Render Go templates to produce text output. Use for generating configuration files, reports, or any text content from templates and variables. Templates render with the engine's full function set (Sprig pipes plus OrchStep functions like regexFind), against the same context steps see (vars, steps, env, stdin).

Parameters

ParameterTypeRequiredDescription
funcstringyesMust be render
args.templatestringone ofInline template string
args.template_filestringone ofPath to a template file (path itself may contain templates)
dostringone ofShorthand for args.template
args.output_filestringnoAlso write the rendered output to this file

Exactly one template source is required: args.template, args.template_file, or the do: shorthand.

Return Values

FieldDescription
result.outputThe rendered text
result.exit_code0 on success
result.status"success"

Examples

Inline template

- name: render_config
  func: render
  args:
    template: |
      app        = {{ vars.app_name }}
      replicas   = {{ vars.replicas }}
      app_upper  = {{ vars.app_name | upper }}
  outputs:
    config: "{{ result.output }}"

Template file to output file

- name: render_nginx
  func: render
  args:
    template_file: "templates/nginx.conf.tmpl"
    output_file: "build/{{ vars.env_name }}/nginx.conf"

Shorthand

- name: banner
  func: render
  do: "deploying {{ vars.app_name }} v{{ vars.version }} to {{ vars.env_name }}"

Consuming rendered output

- name: tpl
  func: render
  args:
    template: "host={{ vars.db_host }}"

- name: verify
  func: assert
  args:
    condition: '{{ contains "host=" steps.tpl.output }}'

Notes

  • The full template function set is available - the same one used in do:/args rendering and outputs: extraction.
  • For ad-hoc experiments, test template expressions with orchstep eval before putting them in a template.