I would like to be able to pass in attributes via the CLI during a chef-run,
So that I can parameterize my ad-hoc tasks in a way where I can key off of said attributes, and do action/assignment therein ..
Example use case:
I want to deploy webapp-v1.23 to a target set of nodes using remote_file .. This means I would need to update my recipe and execute chef-run to make it work as expected .. What I would prefer is to be able to pass in an attribute via the CLI that I can then refer to in my recipe .. For example:
remote_file '/opt/tomcat/webapps/user.war' do source "http://nexus.example.com/user-#{node['user_webapp_version']}" owner "tomcat" group "tomcat" mode "0755" action :createend
And the way I would invoke it would be to do something like this:
This will enable me to use chef-run as my tool of choice via my automation platform (Jenkins, etc.) to perform ad-hoc tasks against target nodes, where I could create an automation "job", pass it parameters, trigger said job, git clone my automation code, and let chef-run :dothething: ..
So a possible rebuttal: "Greg, that info should be in code, not as some parameter that is passed in via the CLI, this is not the Chef way" .. I agree !! But since there is no way to generically assign attributes to targets, there is a way where this same feature could be used to key off of a CLI parameter to refer to code .. Here is an example:
As a
chef-run
user,I would like to be able to pass in attributes via the CLI during a
chef-run
,So that I can parameterize my ad-hoc tasks in a way where I can key off of said attributes, and do action/assignment therein ..
Example use case:
I want to deploy webapp-v1.23 to a target set of nodes using
remote_file
.. This means I would need to update my recipe and executechef-run
to make it work as expected .. What I would prefer is to be able to pass in an attribute via the CLI that I can then refer to in my recipe .. For example:And the way I would invoke it would be to do something like this:
This will enable me to use
chef-run
as my tool of choice via my automation platform (Jenkins, etc.) to perform ad-hoc tasks against target nodes, where I could create an automation "job", pass it parameters, trigger said job, git clone my automation code, and letchef-run
:dothething: ..So a possible rebuttal: "Greg, that info should be in code, not as some parameter that is passed in via the CLI, this is not the Chef way" .. I agree !! But since there is no way to generically assign attributes to targets, there is a way where this same feature could be used to key off of a CLI parameter to refer to code .. Here is an example:
And the way I would invoke it would be to do something like this:
Addendum: I want to be able to use this
--node-attr
option multiple times via the same execution .. For example:Aha! Link: https://chef.aha.io/epics/WS-E-22