How to format a variable in Ansible value

后端 未结 1 783
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-17 18:09

Given that Ansible processes all variables through Jinja2, and doing something like this is possible:

- name: Debug sequence item value
  debug: msg={{ \'Ite         


        
1条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-17 18:48

    It took me a couple of tries to get this right, but try this, instead:

    debug: msg={{ 'Item\:\ %02d'|format(item|int) }}
    

    Jinja2 is a bit funny.

    0 讨论(0)
提交回复
热议问题