Ansible: How to byapss this warning "The value 22 (type int) in a string field was converted to '22' (type string)"

Viewed 384

I have below variable declared in my defaults/main.yml

port: 22

In my play when i'm using the variable port for credentials

credentials:
  host: "{{ loopback_v4 }}"
  username: "user"
  ssh_keyfile: "/id_rsa"
  port: "{{port }}"

When i run the play i am getting below warning

[WARNING]: The value 22 (type int) in a string field was converted to '22' (type string). If this does not look like what you expect, quote
the entire value to ensure it does not change.

I know i can get rid of this by adding a string filter like below

port: "{{port | string }}"

But i need to make changes in lot of places. So is there any other way to address this warning from the defaults/main.yml itself?

0 Answers
Related