[chef] Why don't work search and how to search in run_list (for example with knife search)?


Chronological Thread 
  • From: Vladimir Skubriev < >
  • To:
  • Subject: [chef] Why don't work search and how to search in run_list (for example with knife search)?
  • Date: Mon, 19 Aug 2013 16:59:02 +0400

I put clients to bacula server config with this command:

template "/etc/bacula/conf.d/clients.conf" do
  source "etc/bacula/conf.d/clients.conf.erb"
  mode 0640
  notifies :restart, resources(:service=>"bacula-director")
  variables(
      :autofindclients => search(:node, 'recipes:cbacula\:\:client')
    )
end

But If any node has in the run list needed recipe, but do not run this recipe the last time (chef-client was run with -o attribute "any_other_recipe_list") then search don't work.

I think that this is not good for me. But when I analysing this behaviour I found some mistakes how i can understand.

This mistakes/problems is in search behaviour. Search does not return true nodes, even despite the fact that it must do it ( see knife search node by hostname). You can see that node has necessary recipes. But knife returns only one node (backup)

#knife search node "recipes:cbacula\:\:client"
1 items found

Node Name:   backup.example.lab
Environment: examplelab
FQDN:        backup.example.lab
IP:          192.168.1.5
Run List:    role[backup_server], recipe[cbacula::client]
Roles:       backup_server
Recipes:     cbacula::database, cbacula::director, cbacula::storage, cbacula::webacula, cbacula::client
Platform:    ubuntu 12.04
Tags:       


But I have another node that has just performed a recipe:

I search the node with this command:

knife search node "hostname:zeus"
1 items found

Node Name:   zeus.example.lab
Environment: examplelab
FQDN:        zeus.example.lab
IP:          45.51.34.55
Run List:    recipe[apt], role[ntp_server], recipe[cftp], recipe[cnfs::server], recipe[cinotify], role[nut_apcrt5000xl_serverroom_server], recipe[fail2ban], recipe[csquiddebproxy::server], recipe[csquiddebproxy], recipe[cbacula::client]
Roles:       ntp_server, nut_apcrt5000xl_serverroom_server
Recipes:     apt, ntp, cftp, cnfs::server, cinotify, nut, fail2ban, csquiddebproxy::server, csquiddebproxy, cbacula::client
Platform:    ubuntu 12.04
Tags:       

Why first search command does not include result with this (zeus) node ?

And I have another question:

I want to search nodes, which run_list contain my recipe. But I cannot find any examples how can i do this with knife and in the recipe.

Thank you very much.
-- 
Best regards,

CVisionLab System Administrator
Vladmir Skubriev



Archive powered by MHonArc 2.6.16.

§