This repository has been archived by the owner on Jun 29, 2022. It is now read-only.
forked from candlepin/rho
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
convert cpu.* fact gathering to raw facts. Closes #107.
- Loading branch information
1 parent
ebb464f
commit 1d81f33
Showing
4 changed files
with
87 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
--- | ||
|
||
- name: gather cpu.vendor_id fact | ||
raw: cat /proc/cpuinfo | grep '^vendor_id\s*:' | sed -n -e 's/^.*vendor_id\s*:\s//p' | ||
register: cpu_vendor_id | ||
ignore_errors: yes | ||
when: '"Cpu_cpu.vendor_id" in facts_to_collect' | ||
|
||
- name: add cpu.vendor_id to dictionary | ||
set_fact: | ||
cpu: "{{ cpu|default({}) | combine({ item: cpu_vendor_id['stdout_lines'][0] }) }}" | ||
with_items: | ||
- 'cpu.vendor_id' | ||
|
||
- name: gather cpu.model_name fact | ||
raw: cat /proc/cpuinfo | grep '^model name\s*:' | sed -n -e 's/^.*model name\s*:\s//p' | ||
register: cpu_model_name | ||
ignore_errors: yes | ||
when: '"Cpu_cpu.model_name" in facts_to_collect' | ||
|
||
- name: add cpu.model_name to dictionary | ||
set_fact: | ||
cpu: "{{ cpu|default({}) | combine({ item: cpu_model_name['stdout_lines'][0] }) }}" | ||
with_items: | ||
- 'cpu.model_name' | ||
|
||
- name: gather cpu.bogomips fact | ||
raw: cat /proc/cpuinfo | grep '^bogomips\s*:' | sed -n -e 's/^.*bogomips\s*:\s//p' | ||
register: cpu_bogomips | ||
ignore_errors: yes | ||
when: '"Cpu_cpu.bogomips" in facts_to_collect' | ||
|
||
- name: add cpu.bogomips to dictionary | ||
set_fact: | ||
cpu: "{{ cpu|default({}) | combine({ item: cpu_bogomips['stdout_lines'][0] }) }}" | ||
with_items: | ||
- 'cpu.bogomips' | ||
|
||
- name: gather cpu.cpu_family fact | ||
raw: cat /proc/cpuinfo | grep '^cpu family\s*:' | sed -n -e 's/^.*cpu family\s*:\s//p' | ||
register: cpu_cpu_family | ||
ignore_errors: yes | ||
when: '"Cpu_cpu.cpu_family" in facts_to_collect' | ||
|
||
- name: add cpu.cpu_family to dictionary | ||
set_fact: | ||
cpu: "{{ cpu|default({}) | combine({ item: cpu_cpu_family['stdout_lines'][0] }) }}" | ||
with_items: | ||
- 'cpu.cpu_family' | ||
|
||
- name: gather cpu.model_ver fact | ||
raw: cat /proc/cpuinfo | grep '^model\s*:' | sed -n -e 's/^.*model\s*:\s//p' | ||
register: cpu_model_ver | ||
ignore_errors: yes | ||
when: '"Cpu_cpu.model_ver" in facts_to_collect' | ||
|
||
- name: add cpu.model_ver to dictionary | ||
set_fact: | ||
cpu: "{{ cpu|default({}) | combine({ item: cpu_model_ver['stdout_lines'][0] }) }}" | ||
with_items: | ||
- 'cpu.model_ver' | ||
|
||
- name: gather cpu.count fact | ||
raw: cat /proc/cpuinfo | grep '^processor\s*:' | wc -l | ||
register: cpu_count | ||
ignore_errors: yes | ||
when: '"Cpu_cpu.count" in facts_to_collect' | ||
|
||
- name: add cpu.count to dictionary | ||
set_fact: | ||
cpu: "{{ cpu|default({}) | combine({ item: cpu_count['stdout_lines'][0] }) }}" | ||
with_items: | ||
- 'cpu.count' | ||
|
||
- name: gather cpu.socket_count fact | ||
raw: sudo -n /usr/sbin/dmidecode -t 4 | grep 'Socket Designation'| wc -l | ||
register: cpu_socket_count | ||
ignore_errors: yes | ||
when: '"Cpu_cpu.socket_count" in facts_to_collect' | ||
|
||
- name: add cpu.socket_count to dictionary | ||
set_fact: | ||
cpu: "{{ cpu|default({}) | combine({ item: cpu_socket_count['stdout_lines'][0] }) }}" | ||
with_items: | ||
- 'cpu.socket_count' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters