On Monday, January 28, 2019 at 3:02:15 PM UTC-7, Kai Stian Olstad wrote:
>
> On 28.01.2019 22:41, John Harmon wrote: 
> > I know I can define the variable previous to this, but I am wondering 
> > if I 
> > can combine setting a variable with a default value within set_fact.   
> > If 
> > possible, I wonder if my syntax is wrong (likely)?  I can't seem to 
> > find 
> > much documentation on this.  If you have a link to this answer in the 
> > docs, 
> > I would like to review it, but apparently I am not using the right 
> > keywords 
> > in my search. 
> > 
> > Basically, I wish to have the handler_name set to Networking unless my 
> > major version is 8.  If that is the case then I want it set to: Network 
> > Manager 
> > 
> > - set_fact: 
> >     handler_name: "{{ 'Network Manager' | default('Networking') }} " 
> >   when: ansible_distribution_major_version == 8 
>
> - set_fact: 
>      handler_name: "{{ 'Network Manager' if 
> ansible_distribution_major_version == 8 else 'Networking' }}" 
>
> or 
>
> - set_fact: 
>      handler_name: "{{ (ansible_distribution_major_version == 8) | 
> ternary('Network Manager', ''Networking') }}" 
>
>
> Which one to use comes down to personal preference. 
>
>
> -- 
> Kai Stian Olstad 
>

Wow, I was really off.  Thanks Kai! 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a9820ae4-1d65-4336-81cf-073fd4da506f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to