Ansible-如何将字符串列表转换为整数列表?

Ansible-如何将字符串列表转换为整数列表?,ansible,jinja2,Ansible,Jinja2,错误:'>'在'str'和'int'实例之间不受支持。 我试过我的列表| int | select(“greaterthan”,2)|列表。但这不管用 将列表中的项目转换为整数。比如说 -调试: msg:{{my_list | map('int')| select('greaterthan',2)| list}} 变量: 我的清单: - "1" - "2" - "3" 给予 “msg”:[ 三 ] 将列表中的项目转换为整数。比如说 -调试: msg:{{my_list | map('int')

错误:
'>'在'str'和'int'实例之间不受支持。


我试过
我的列表| int | select(“greaterthan”,2)|列表
。但这不管用

将列表中的项目转换为整数。比如说

-调试:
msg:{{my_list | map('int')| select('greaterthan',2)| list}}
变量:
我的清单:
- "1"
- "2"
- "3"
给予

“msg”:[
三
]

将列表中的项目转换为整数。比如说

-调试:
msg:{{my_list | map('int')| select('greaterthan',2)| list}}
变量:
我的清单:
- "1"
- "2"
- "3"
给予

“msg”:[
三
]
- debug: 
    var: my_list | select("greaterthan", 2) | list
  vars: 
    my_list: 
      - "1"
      - "2"
      - "3"