Reputation: 31520
chef-client v12.15.19 (MSI installer) On Windows Server 2012 R2
Instead of having to be in the directory where knife.rb is located or put knife.rb in one of the pre-determined locations where knife looks for that config, can I just pass it in as an argument?
Example: knife.bat node list -config_file c:\some\other\place\knife.rb
I'm just curious if this is possible because I didn't see this anywhere in the docs. I know I could workaround this with an environment variable and possibly other ways, but I just was wondering if there was an arg to pass the knife.rb directly.
Upvotes: 1
Views: 1076
Reputation: 31
Yes, you can specify but mind the parameters sequence.
knife cookbook upload my_test_cookbook -c ./knife.rb
You can specify options only after your main command is complete. The same you can check in knife help : Usage: knife sub-command (options)
Upvotes: 0
Reputation: 2825
Yes, you can specify a different configuration file. Here's a snip of the knife --help
output from the latest Chef 12.x releases (at the time of this writing):
-c, --config CONFIG The configuration file to use
--config-option OPTION=VALUE Override a single configuration option
So you should be able to do knife -c ...
. I use this regularly to manage different knife configuration files for different hosted chef instances. I don't see it mentioned in any docs explicitly either.
Upvotes: 6