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
Jinja extrapolation for openshift_hosted_...
vars doesn't work
#5657
Comments
I am also seeing this problem. Someone, please let me know if you would prefer I open a separate issue instead. I have in my inventory as below.
When this goes into openshift_facts it does not get interpolated. Then when the same variable name is set sourced from the openshift facts it gets set as the raw string. Here is a simplified playbook showing the problem.
And the output.
|
/assign michaelgugino |
FYI, the proper name is 'templating' for this problem. This happens when a plugin (module, action, etc) uses a variable that is not passed in as a parameter. This is an issue that plagues us in a variety of places. |
This has really lead down the rabbit hole: #6306 Cleaning up some openshift_facts items first, that will probably clear most of this right up. |
Description
The
openshift_hosted_*
variables need to be hard coded even when declared ingroup_vars/OSEv3.yml
which normally allows Jinja templating.See below for more details, but it seems the
openshift_facts
role is doing something really weird with the way it processes theopenshift_hosted_*
vars. I tried to look into it, but got lost so even an explanation how it all works might help me.My ultimate goal of this is to be able to use a lookup plugin for specifying the volume details for the hosted registry, but this issue seems to affect more than just that usecase.
Version
Ansible version per
ansible --version
:ansible 2.3.0.0
The output of
git describe
:openshift-ansible-3.6.22-1
I tried this on master (
openshift-ansible-3.7.0-0.141.0
) as well, but I can't even get that far because of an unrelated error. Running thesetup
module after the deployment seems to show it's broken there as well.Steps To Reproduce
group_vars/OSEv3.yml
file alongside yourinventory/hosts
fileOSEv3.yml
file. Here's a simplified version of mine:(it uses a Cinder-backed hosted registry, but the issue here is how openshift-ansible sets the local facts rather than the openstack/cinder integration)
Put a jinja code in the
openshift_hosted_registry_storage_volume_size
variable inOSEv3.yml
(note that the{{ 5 + 5 }}Gi
value here is just an example. I'm using something more complex, but this illustrates the issue)Run the byo playbook:
Expected Results
The playbook should finish successfully, creating a Cinder-backed registry.
Observed Results
The playbook fails during the PV creation:
The PV config file from the error message (
/tmp/openshift-ansible-VX52l1a/persistent-volumes.yml
reveals that theopenshift_hosted_registry_storage_volume_size
was included verbatim, not processed:(note the
storage
line: it should say10Gi
instead)The values seem to be coming from the local facts set by
openshift_facts
role:It seems the role that processes the
openshift_hosted_*
variables is accessing the raw values from the the group_vars file as if it were actually reading and parsing the YAML. I didn't even know Ansible lets you access the unprocessed values.Note that when I add a
debug: var=openshift_hosted_registry_storage_volume_size
task to the playbooks, it shows the correct value (10Gi
) and Ansible/openshift-ansible processes all the other vars (e.g. the openstack creds environment lookups) as expected.Additional Information
The text was updated successfully, but these errors were encountered: