Case statement for setting var in Ansible/Jinja2

前端 未结 3 1572
眼角桃花
眼角桃花 2020-12-30 04:02

I\'m using Ansible with Jinja2 templates, and this is a scenario that I can\'t find a solution for in Ansible\'s documentation or googling around for Jinja2 examples. Here\'

3条回答
  •  感情败类
    2020-12-30 04:27

    you don't need to set var, because I'm guessing that you trying to set var for some condition later. Just make condition there like

    - name: Later task
      shell: "command is here"
      when: {{ existing_ansible_var }} == "string1"
    

    and get a profit

提交回复
热议问题