Re: [ansible-project] Re: How to get processeur vendor ?

2018-02-23 Thread Kai Stian Olstad
On Tuesday, 13 February 2018 22.01.30 CET Eric Secrist wrote:
> Hi Flow,
> Did you ever get an answer to your question. I see a different number of 
> list values for ansible_processor between two hosts, which makes it 
> difficult to easily gather the processor vendor across many hosts.
> 
> ok: [host1] => {
> "hostvars[inventory_hostname].ansible_processor": [
> "GenuineIntel",
> "Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz",
> "GenuineIntel",
> "Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz"
> ]
> }
> 
> ok: [host2] => {
> "hostvars[inventory_hostname].ansible_processor": [
> "0",
> "GenuineIntel",
> "Intel(R) Xeon(R) CPU E5-2680 0 @ 2.70GHz",
> "1",
> "GenuineIntel",
> "Intel(R) Xeon(R) CPU E5-2680 0 @ 2.70GHz"
> ]
> }
> 
> host2 has the extra list values of "0" and "1".

The variable ansible_processor, on Linux it is parsing /proc/cpuinfo line by 
line while looking for 
'model name', 'Processor', 'vendor_id', 'cpu', 'Vendor', 'processor'

The first one it find become element 0 and the second becomes element 1 and so 
on.
So if your /proc/cpuinfo differ you will get different result on different host.

So if you host1 and host2 is Linux it did not find processor on host1 because 
it does not exist in /proc/cpuinfo therefor the element 0 in the list become 
the vendor_id instead since it found that first.

This make ansible_processor unpredictable and you should probably find the 
information yourself.

-- 
Kai Stian Olstad

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2337408.MFPsHbjV8d%40x1.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: How to get processeur vendor ?

2018-02-13 Thread Eric Secrist
Hi Flow,
Did you ever get an answer to your question. I see a different number of 
list values for ansible_processor between two hosts, which makes it 
difficult to easily gather the processor vendor across many hosts.

ok: [host1] => {

"hostvars[inventory_hostname].ansible_processor": [

"GenuineIntel",

"Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz",

"GenuineIntel",

"Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz"

]

}

ok: [host2] => {

"hostvars[inventory_hostname].ansible_processor": [

"0",

"GenuineIntel",

"Intel(R) Xeon(R) CPU E5-2680 0 @ 2.70GHz",

"1",

"GenuineIntel",

"Intel(R) Xeon(R) CPU E5-2680 0 @ 2.70GHz"

]

}

host2 has the extra list values of "0" and "1".

Thanks,
Eric

On Friday, January 12, 2018 at 8:50:38 AM UTC-7, Florent wrote:
>
> Hi, 
>
> I would like to get the processor vendor of any host. 
>
> I see a lot of examples over the internet using a condition like this : 
>
> '"Intel" in ansible_processor[0]' 
>
> But my "ansible_processor[0]" variable on my hosts contains ... "0" !! 
>
> I use Ansible 2.4.2.0. When did it change ? Is it expected to work like 
> this ? What about computers having single CPU ? 
>
> Thank you. 
>
> Flo 
>
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5adbb41d-8f41-43ec-999d-b95aa5dc2cba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.