Hello, why does short circuit only works for the first two cases:
- hosts: localhost
become: false
vars:
ivar: '{{hostvars[inventory_hostname].dne}}'
tasks:
- debug:
msg: "works: {{'foo' or dne}}"
- debug:
msg: "works: {{'bar' or hostvars[inventory_hostname].dne}}
On Sat, 15 May 2021 16:55:24 -0700
Scott Mcdermott wrote:
> Hello, why does short circuit only works for the first two cases:
>
> - hosts: localhost
> become: false
> vars:
> ivar: '{{hostvars[inventory_hostname].dne}}'
> tasks:
> - debug:
> msg: "works: {{'foo' or dne}}"
>
On Sun, 16 May 2021 08:54:29 +0200
Vladimir Botka wrote:
> On Sat, 15 May 2021 16:55:24 -0700
> Scott Mcdermott wrote:
>
> > Hello, why does short circuit only works for the first two cases:
> >
> > - hosts: localhost
> > become: false
> > vars:
> > ivar: '{{hostvars[inventory_hostname
On Sun, May 16, 2021 at 12:23 AM Vladimir Botka wrote:
> third debug task fails because the expansion of the string
> "{{ ... }}" fails before the *or* expression could be evaluated.
Sure, but why is it expanded at all? You're right that we can
make my already-minimal test when variable Does Not
On Sun, 16 May 2021 01:35:46 -0700
Scott Mcdermott wrote:
> I cannot use a default because this whole thing is relying
> on whether it's defined or not later to take different actions.
> the fuller example is:
>
> - name: determine_subnet
> when: >
> project == project_bake
> or hostva
On Sun, 16 May 2021 22:51:02 +0200
Vladimir Botka wrote:
> On Sun, 16 May 2021 01:35:46 -0700
> Scott Mcdermott wrote:
>
> > I cannot use a default because this whole thing is relying
> > on whether it's defined or not later to take different actions.
> > the fuller example is:
> >
> > - name:
On Sun, May 16, 2021 at 1:51 PM Vladimir Botka wrote:
> > I cannot use a default because this whole thing is relying
> > on whether it's defined or not later to take different actions.
> > the fuller example is:
> >
> > - name: determine_subnet
> > when: >
> > project == project_bake
> >
On Sun, May 16, 2021 at 2:26 PM Vladimir Botka wrote:
> > > I cannot use a default because this whole thing is relying
> > > on whether it's defined or not later to take different actions.
> > > the fuller example is:
> > >
> > > - name: determine_subnet
> > > when: >
> > > project == projec
On Sun, May 16, 2021 at 1:55 AM Scott Mcdermott wrote:
>
> Hello, why does short circuit only works for the first two cases:
>
> - hosts: localhost
> become: false
> vars:
> ivar: '{{hostvars[inventory_hostname].dne}}'
> tasks:
> - debug:
> msg: "works: {{'foo' or dne}}"
>
On Tue, 18 May 2021 14:54:07 +0200
Martin Krizek wrote:
> This is effectively a side-effect of functionality in Ansible's
> templating engine that allows nesting variables ...
FWIW, one more of this kind not mentioned yet, I think
- debug:
var: my_dict.a
vars:
my_dict:
10 matches
Mail list logo