Hi R.Rao,

Thanks, gonna try that 

Bruno

On Friday, April 12, 2019 at 3:21:57 PM UTC+1, Raghavendra Rao wrote:
>
> I use these ansible facts for differentiating between physical and virtual 
> guests:
>
>         "ansible_virtualization_role": "guest", 
>         "ansible_virtualization_type": "kvm", 
>
> These work perfect along with a 'when' conditional. For example:
>
> - template:
>      src: <templatefile for virtual machine on control node>
>      dest: <the destination on managed host>
>  when: ansible_virtualization_role is defined or 
> ansible_virtualization_role == "kvm"
>
> If you want to explore more variables, run the following adhoc command on 
> both the physical and virtual hosts and notice the change is the value of 
> variables that facts report:
>
> #ansible all -m setup | less
>
> -R.Rao
>
> On Fri, 12 Apr 2019 at 17:50, Bruno Cochofel <[email protected] 
> <javascript:>> wrote:
>
>> Hi,
>>
>> I'm trying to write a role that has different template file if the server 
>> is virtual os physical.
>> What's the best way to filter this?
>>
>> Thanks,
>> Bruno
>>
>> -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/9d6a483a-90fb-4f17-a2df-45c0832971ec%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/9d6a483a-90fb-4f17-a2df-45c0832971ec%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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/3e77f60f-3690-4894-94cd-45cdf36d346e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to