Ansible 基于密钥最后字符的Jinja2排序字典
我有以下yaml字典:Ansible 基于密钥最后字符的Jinja2排序字典,ansible,jinja2,Ansible,Jinja2,我有以下yaml字典: test: 'xe-0/0/1': test: test 'xe-0/0/2': test: test 'xe-0/0/10': test: test 'xe-0/0/3': test: test 我想根据斜杠后的最后一个数字对循环进行排序。使用排序过滤器,我得到这个 {{ test | sort }} ["xe-0/0/1", "xe-0/0/10", &q
test:
'xe-0/0/1':
test: test
'xe-0/0/2':
test: test
'xe-0/0/10':
test: test
'xe-0/0/3':
test: test
我想根据斜杠后的最后一个数字对循环进行排序。使用排序过滤器,我得到这个
{{ test | sort }}
["xe-0/0/1",
"xe-0/0/10",
"xe-0/0/2",
"xe-0/0/3"]
我怎样才能得到正确的排序,使10在3之后