Ansible condition when string not matching

后端 未结 2 769
情书的邮戳
情书的邮戳 2021-01-31 15:53

I am trying to write an Ansible playbook that only compiles Nginx if it\'s not already present and at the current version. However it compiles every time which is undesirable.

2条回答
  •  遥遥无期
    2021-01-31 16:24

    Try:

    when: nginxVersion.stdout != 'nginx version: nginx/1.8.0'
    

    or

    when: '"nginx version: nginx/1.8.0" not in nginxVersion.stdout'
    

提交回复
热议问题