How do I add a recipe to a chef run list?

12,604

I guess you are on PowerShell? See https://docs.chef.io/knife_node.html#id19 about escaping the knife node run_list add call

Share:
12,604
Mark
Author by

Mark

Lead developer for a major Medical Informatics software company

Updated on June 22, 2022

Comments

  • Mark
    Mark almost 2 years

    I have a chef node that I'm attempting to add a recipe to. Currently, this node has one recipe in the run list:

    $ knife node show mynode
    Node Name:   mynode
    Environment: _default
    FQDN:        mynode.domain
    IP:          10.8.16.214
    Run List:    recipe[mycb::myrecipe1]
    Roles:
    Recipes:     mycb::myrecipe1, ms_dotnet::ms_dotnet4, ms_dotnet::default, windows::default
    Platform:    windows 6.3.9600
    Tags:
    

    I'm attempting to add a new recipe (mycb::recipe2) to the run list for this node:

    $ knife node run_list add mynode 'recipe[mycb::myrecipe2]'
    mynode:
      run_list:
        recipe[mycb::myrecipe1]
        recipe[recipes]
    

    This new recipe recipe[recipes] is quite strange. I do not have a cookbook called recipes:

    $ knife recipe-list
    chef-sugar
    chef_handler
    chef_handler::json_file
    mycb
    mycb::myrecipe1
    mycb::myrecipe2
    ms_dotnet
    ms_dotnet::ms_dotnet2
    ms_dotnet::ms_dotnet3
    ms_dotnet::ms_dotnet4
    ms_dotnet::regiis
    openssl
    openssl::upgrade
    sql_server
    sql_server::client
    sql_server::server
    windows
    windows::reboot_handler
    

    I also don't have a cookbook called recipes:

    $ knife cookbook list
    chef-sugar     3.1.0
    chef_handler   1.1.9
    mycb           0.1.0
    ms_dotnet      2.3.0
    openssl        4.0.0
    sql_server     2.2.3
    windows        1.37.0
    

    Where is this coming from, and how do I cause the correct recipe to be added?

  • Mark
    Mark almost 9 years
    Indeed this was the problem. An open question is "why didn't knife fail". Also, knife.bat should be replaced with knife.ps1 :)