Re: [ansible-project] Condititionals

7 views
Skip to first unread message

Kai Stian Olstad

unread,
Sep 3, 2016, 6:29:45 PM9/3/16
to ansible...@googlegroups.com
On 03. sep. 2016 23:15, Tony Owens wrote:
> In my yml I have this defined.
>
>
> 1. - name: "pull image to force update if ImageTag=latest"
> 2. shell: "docker pull {{ image }}"
> 3. when: "{{ ImageTag == latest }}"
>
> but I get this error when executing. I know that I could use ignore_errors
> but that doesn't seem like the right thing to do here. I would expect this
> to evaluate as not true and move on to the next task in the playbook. Any
> tips?

Never use curly brackets in when, they are implied.
And since latest is a string use qoutes, if not latest will be treated
as a variable, so this should work:

when: ImageTag == "latest"

--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages