Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ansible 基于密钥最后字符的Jinja2排序字典_Ansible_Jinja2 - Fatal编程技术网

Ansible 基于密钥最后字符的Jinja2排序字典

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

我有以下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", 
"xe-0/0/2", 
"xe-0/0/3"]
我怎样才能得到正确的排序,使10在3之后