Ability to include `{{ variable }}` in CreateFile content
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Tell us about your request
I'd like to be able to write out an Ansible playbook (itself being yaml) using Image Builder Component action CreateFile. In this playbook we have a looping construct that is coincidentally, syntactically identical to component parameter substitution syntax. It uses {{ variable }}. I need to be able to escape those curly braces in the context of Image Builder, so the string ends up as-is in the file created in the image.
Overly simplified example, not valid Ansible playbook yaml but you should get the point:
name: CreateAnsiblePlaybook
schemaVersion: 1.0
phases:
- name: build
steps:
- name: CreatePlaybook
action: CreateFile
inputs:
- path: /tmp/playbook.yaml
overwrite: true
content: |
I want Image Builder to not try to substitute this next line:
{{ myAnsibleVariable }}
In the above example, trying to create this component would result in error The value supplied for parameter 'data' is not valid. Parameter validation failed for document index '0' phase 'build' step 'CreatePlaybook'. Error: Parameter 'myAnsibleVariable' not declared but referenced.
I couldn't find any hint for escaping syntax in the documentation, and I tried plenty of permutations with \ and `
Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?
Are you currently working around this issue? Saving the file to an http repository and using WebDownload
Additional context
Attachments