'Best way to migrate the ansible group_var file to a simple environment variables in shell script

I am trying to migrate from Ansible to a simple GitLab Helm installation. As a part of the ansible playbook, there was a group_var file containing a bunch of template variables which were replaced in the template files with ansible task. I am trying to find a better way to handle this in the shell script. Simple key values are easy to replace but it has some lists too. Has anyone done anything similar ? I am leaning towards exporting them to environment variables and running envsubst command on the helm values files.

Sample file:

redis-url: url
search-host: host_name
search-port: 9090
rate_limit_external_gateway_max: 6
rate_limit_external_gateway_headers: true
rate_limit_external_gateway_test_mode: true
rate_limit_external_gateway_black_list_headers: [
  X-RateLimit-Limit,
  X-RateLimit-Remaining,
  X-RateLimit-Reset
]

hosts:
  - x.domain.com
  - y.domain.com
  - z.domain.com


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source