L19 – Search with knife
Use
$ ohai
on the client to see the state.
OR use the chef server web interface.
knife search node key:pattern -a attribute
SHOW
====
$ knife node show -a apache
cc: apache: package: httpd sites: vchefh1h.com: domain: Â Â vchefh1h.com port: Â Â Â 80 site_title: VCHEFH1H vchefh2h.com: domain: Â Â vchefh2h.com port: Â Â Â 80 site_title: VCHEFH2H Â $ knife node show cc -a apache.sites cc: apache.sites: vchefh1h.com: domain: Â Â vchefh1h.com port: Â Â Â 80 site_title: VCHEFH1H vchefh2h.com: domain: Â Â vchefh2h.com port: Â Â Â 80 site_title: VCHEFH2H [hallapa@cw chef-repo]$ Â $ knife node show -a apache.sites.name1: apache.sites.name1:domain: Â Â name1.phh.com
port: Â Â Â 80
site_title: node1site
$ knife node show -a apache.sites.name1.domain
apache.sites.name1.domain: Â Â name1.phh.com$ knife node show cc -a memory
cc:
memory:
active: Â Â Â Â Â 873276kB
anon_pages: Â Â Â 910920kB
bounce: Â Â Â Â Â 0kB
buffers: Â Â Â Â Â 20kB
cached: Â Â Â Â Â 586884kB
commit_limit: Â Â 2989000kB
committed_as: Â Â 4242948kB
dirty: Â Â Â Â Â Â 8kB
free: Â Â Â Â Â Â 104836kB
hugepage_size: Â Â 2048kB
hugepages:
free: Â Â 0
reserved: 0
surplus: Â 0
total: Â Â 0
inactive: Â Â Â Â 633960kB
mapped: Â Â Â Â Â 125484kB
nfs_unstable: Â Â 0kB
page_tables: Â Â Â 31924kB
slab: Â Â Â Â Â Â 81084kB
slab_reclaimable: 37532kB
slab_unreclaim: Â 43552kB
swap:
cached: 10916kB
free: Â 1863680kB
total: Â 2097148kB
total: Â Â Â Â Â Â 1783708kB
vmalloc_chunk: Â Â 34359697400kB
vmalloc_total: Â Â 34359738367kB
vmalloc_used: Â Â 32728kB
writeback: Â Â Â Â 0kB
$ knife node show cc -a memory.active
cc:
memory.active: 873276kB
======
$ knife search node “os:linux”
1 items found
Node Name: Â cc
Environment: _default
FQDN: Â Â Â Â cc
IP: Â Â Â Â Â 10.32.9.34
Run List: Â Â recipe[secdel], recipe[apache]
Roles:
Recipes: Â Â secdel, secdel::default, apache, apache::default, php::default
Platform: Â Â oracle 7.3
Tags:
$ knife search node “os:linux” -a memory.swap.free
1 items found
cc:
memory.swap.free: 1863680kB
knife search node “platform:ubuntu” -a memory.swap.free
knife search node “platform:*” -a memory.swap.free
knife search node “kernel_release:3.2*”
knife search node “kernel_release:3.2*” -a kernel.release
knife search node “kernel_release:*” -a kernel.release
knife search node “os:linux AND platform:ubuntu” -a kernel
knife search node “os:linux AND platform_family:debian” -a platform
knife search node “os:linux AND platform_family:debian” -a platform.family Searching for a nested value
knife search node “os:linux AND platform_family:debian” -a platform_family
Discussion ¬