Created
February 8, 2024 16:57
-
-
Save jpmens/588d62a7f8943535ceaaf77e09f96718 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat numbers.yml | |
- hosts: localhost | |
vars: | |
i: "17" # strings here like from register, etc. | |
f: "92.87" | |
s: "my name" | |
tasks: | |
- set_fact: | |
numbers: | |
my_i: "{{ i }}" | |
my_f: "{{ f }}" | |
my_s: "{{ s }}" | |
- debug: var=numbers | |
$ ansible-playbook numbers.yml | |
TASK [debug] ************************************************************************ | |
ok: [localhost] => { | |
"numbers": { | |
"my_f": "92.87", <----- strings | |
"my_i": "17", | |
"my_s": "my name" | |
} | |
} | |
$ ANSIBLE_JINJA2_NATIVE=True ansible-playbook numbers.yml | |
TASK [debug] ************************************************************************ | |
ok: [localhost] => { | |
"numbers": { | |
"my_f": 92.87, <----- NOT strings | |
"my_i": 17, | |
"my_s": "my name" | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment