-
Notifications
You must be signed in to change notification settings - Fork 23.8k
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
copy content output from json and a variable is not idempotent under py3 #34595
Comments
Files identified in the description: If these files are inaccurate, please update the |
You have properly identified that if the string contains a variable, that it triggers a change in functionality. To step you through the process:
Because We have recently gotten functionality into jinja2 to return native data types, and are working to integrate this functionality into ansible, which will allow ansible to stop guessing the data should be a python datatype, and instead of leaving alone. Instead of using the If you have further questions please stop by IRC or the mailing list:
|
This adds osinfo lookup source that makes it possible to use libosinfo information in templates. There are two ways to reference an attribute: - object style - lookup().name - dict style - lookup()["name"] Arrays can be accessed using numerical indices like this: lookup('osinfo', 'fedora15')["minimum_resources.0.ram"] Beware though: Ansible has a bug [1] that makes it impossible to use this lookup source from Ansible files like this: "{{ lookup(..) }}". Ansible / Jinja2 always converts the result to AnsibleUnsafeText intead of keeping it in the original native type and that breaks the proxy used to access all the result attributes. [1] ansible/ansible#34595 (comment)
This adds osinfo lookup source that makes it possible to use libosinfo information in templates. There are two ways to reference an attribute: - object style - lookup().name - dict style - lookup()["name"] Arrays can be accessed using numerical indices like this: lookup('osinfo', 'fedora15')["minimum_resources.0.ram"] Beware though: Ansible has a bug [1] that makes it impossible to use this lookup source from Ansible files like this: "{{ lookup(..) }}". Ansible / Jinja2 always converts the result to AnsibleUnsafeText intead of keeping it in the original native type and that breaks the proxy used to access all the result attributes. [1] ansible/ansible#34595 (comment)
This adds osinfo lookup source that makes it possible to use libosinfo information in templates. There are two ways to reference an attribute: - object style - lookup().name - dict style - lookup()["name"] Arrays can be accessed using numerical indices like this: lookup('osinfo', 'fedora15')["minimum_resources.0.ram"] Beware though: Ansible has a bug [1] that makes it impossible to use this lookup source from Ansible files like this: "{{ lookup(..) }}". Ansible / Jinja2 always converts the result to AnsibleUnsafeText intead of keeping it in the original native type and that breaks the proxy used to access all the result attributes. [1] ansible/ansible#34595 (comment)
This adds osinfo lookup source that makes it possible to use libosinfo information in templates. There are two ways to reference an attribute: - object style - lookup().name - dict style - lookup()["name"] Arrays can be accessed using numerical indices like this: lookup('osinfo', 'fedora15')["minimum_resources.0.ram"] Beware though: Ansible has a bug [1] that makes it impossible to use this lookup source from Ansible files like this: "{{ lookup(..) }}". Ansible / Jinja2 always converts the result to AnsibleUnsafeText intead of keeping it in the original native type and that breaks the proxy used to access all the result attributes. [1] ansible/ansible#34595 (comment)
ISSUE TYPE
COMPONENT NAME
copy_module
ANSIBLE VERSION
also seen on:
CONFIGURATION
(no output -- no changes to ansible.cfg, this is a clean ubuntu 16.04 VM with python, pip, virtualenv, a clone of the ansible repo, and
pip -r requirements.txt
)OS / ENVIRONMENT
ubuntu 16.04, managing itself
SUMMARY
When running under python 3, using copy.content with literal json and a variable in the input, the output varies from run to run (the dict keys are being reordered arbitrarily).
STEPS TO REPRODUCE
Run the playbook below with:
Note in the example playbook:
EXPECTED RESULTS
ACTUAL RESULTS
See example run below.
Note that:
The text was updated successfully, but these errors were encountered: