-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible to use Ansible variables in deployments? #1750
Comments
Same as I'm seeing in #1701 ? |
Yes, any field in the spec of the custom resource being reconciled will be converted from camel to snake case and passed in to Ansible as an extra_var, and the meta field with name and namespace is passed in as well. It looks like the sample you posted has a yaml formatting issue though,
Should be
Additionally, make sure you are running the Ansible templating engine when reading from that file. The most common pattern is to use the
|
Ah - I see! This really opens up for possibilities Ok, I tried it like this (I know this will not work because of mix of kubernetes syntax and ansible, but how should you do it?)
But when I am try to deploy the file:
I am getting
|
So I have a task (in roles/$name/tasks/main.yml) that looks like this:
and the template (in roles/$name/templates/services.yml.j2) looks like this:
The CR that it uses to gather the variables looks something like this and it added with
|
I have a deployment which adds a cronjob to a deployment, and I want that cronjob to use variables from ansible - is that possible? Or could I in another way get variables from an operator?
Here is an example what I would like to do:
When trying this, the operator errors out and complains about '{{ meta.name }} - which it thinks is a string.
The text was updated successfully, but these errors were encountered: