Manage role-node association with scm?

Hi all,
I’m a newbie with Chef, just started the last week, hope this is a smart
question :slight_smile:

I really like the possibility to manage the infrastructure using GIT,
but I’m not understanding how to save the relationships between nodes
and their roles in the chef-repo. What I’m doing now to add a role to a
node is:

knife node run_list add “role[cool_role]”

but this doesn’t leave any trace in the chef-repo files, so it’s
impossible to save the associations in the SCM.
Is it possible to use ruby/json files to manage the nodes’ roles? Or the
only ways are knife and the chef-server web interface?

I tried to solve the problem reading the docs, but they are really a lot
and I didn’t find anything useful for this :expressionless:

Thanks!

On Aug 8, 2013, at 8:33 AM, Tommaso Visconti tommaso.visconti@gmail.com wrote:

knife node run_list add "role[cool_role]"

but this doesn't leave any trace in the chef-repo files, so it's impossible to save the associations in the SCM.
Is it possible to use ruby/json files to manage the nodes' roles? Or the only ways are knife and the chef-server web interface?

Well, "knife role from file" will get you the roles themselves stored in a format that you can check into the SCM, but that doesn't help with the information about the nodes and what roles have been applied to them.

What I've done in the past is to do a "knife node edit" any time I wanted to add a role or delete a role from a node, or otherwise make changes to the runlist on a node. But you're right that this information isn't checked into an SCM anywhere. You could dump the information from a "knife node show nodename -l" into a file format that could be checked into an SCM, but most of the information will be auto-discovered by ohai, and you really want to let ohai do the job you're asking it to do.

For my part, I considered this information about the node itself to be fairly ephemeral, and the information available from the Chef database regarding the roles, runlists, and other details about a node has been sufficient. So long as Chef keeps track of what is applied to what node, I haven't really cared.

I tried to solve the problem reading the docs, but they are really a lot and I didn't find anything useful for this :expressionless:

The search interface on docs.opscode.com is decent, but it definitely has limits. If you know a keyword or two, that's usually enough to get you to a set of pages, one of which is likely to have information that leads you to an answer for your question. But if you don't know what you're looking for, or it's more specific than can be crammed into just a keyword or two, then you're less likely to be successful.

--
Brad Knowles brad@shub-internet.org
LinkedIn Profile: http://tinyurl.com/y8kpxu

One way of expressing, say, a cluster or group of machines using something
SCM-able is to use spiceweasel, which basically converts a YAML file into a
bunch of knife commands. Different people seem to use it in different ways
(for example, I use it to set up a Chef server with all the objects in a
Chef repository for testing), but maybe this will give you some ideas. Or
at least a keyword to search against. :wink:

Check it out:

On Thu, Aug 8, 2013 at 7:31 AM, Brad Knowles brad@shub-internet.org wrote:

On Aug 8, 2013, at 8:33 AM, Tommaso Visconti tommaso.visconti@gmail.com
wrote:

knife node run_list add "role[cool_role]"

but this doesn't leave any trace in the chef-repo files, so it's
impossible to save the associations in the SCM.
Is it possible to use ruby/json files to manage the nodes' roles? Or the
only ways are knife and the chef-server web interface?

Well, "knife role from file" will get you the roles themselves stored in a
format that you can check into the SCM, but that doesn't help with the
information about the nodes and what roles have been applied to them.

What I've done in the past is to do a "knife node edit" any time I wanted
to add a role or delete a role from a node, or otherwise make changes to
the runlist on a node. But you're right that this information isn't
checked into an SCM anywhere. You could dump the information from a "knife
node show nodename -l" into a file format that could be checked into an
SCM, but most of the information will be auto-discovered by ohai, and you
really want to let ohai do the job you're asking it to do.

For my part, I considered this information about the node itself to be
fairly ephemeral, and the information available from the Chef database
regarding the roles, runlists, and other details about a node has been
sufficient. So long as Chef keeps track of what is applied to what node, I
haven't really cared.

I tried to solve the problem reading the docs, but they are really a lot
and I didn't find anything useful for this :expressionless:

The search interface on docs.opscode.com is decent, but it definitely has
limits. If you know a keyword or two, that's usually enough to get you to
a set of pages, one of which is likely to have information that leads you
to an answer for your question. But if you don't know what you're looking
for, or it's more specific than can be crammed into just a keyword or two,
then you're less likely to be successful.

--
Brad Knowles brad@shub-internet.org
LinkedIn Profile: http://tinyurl.com/y8kpxu

We store all our nodes as ruby files in our SCM in the nodes/ folder. The
trick is to only set normal attributes there. We also patched the knife
node from file code to be "search safe" (knife node from file with our
patch only overwrite normal attributes on the node, so that ohai and other
data is still there and the node is discoverable through search)

In general our workflow is to have everything manual done in git and we
developed a plugin (based on knife essentials but managing ruby files, not
only JSON) that will "sync" the Chef Server from what is in git, this sync
is considered a "release" or "deployment" of our infrastructure. Pretty
much mirroring a dev workflow of a normal app, just that our app is the
infra and chef has the code :slight_smile:
On Aug 8, 2013 9:43 PM, "steve ." leftathome@gmail.com wrote:

One way of expressing, say, a cluster or group of machines using something
SCM-able is to use spiceweasel, which basically converts a YAML file into a
bunch of knife commands. Different people seem to use it in different ways
(for example, I use it to set up a Chef server with all the objects in a
Chef repository for testing), but maybe this will give you some ideas. Or
at least a keyword to search against. :wink:

Check it out:

GitHub - mattray/spiceweasel: Generates Chef knife commands from a simple JSON or YAML file.

On Thu, Aug 8, 2013 at 7:31 AM, Brad Knowles brad@shub-internet.orgwrote:

On Aug 8, 2013, at 8:33 AM, Tommaso Visconti tommaso.visconti@gmail.com
wrote:

knife node run_list add "role[cool_role]"

but this doesn't leave any trace in the chef-repo files, so it's
impossible to save the associations in the SCM.
Is it possible to use ruby/json files to manage the nodes' roles? Or
the only ways are knife and the chef-server web interface?

Well, "knife role from file" will get you the roles themselves stored in
a format that you can check into the SCM, but that doesn't help with the
information about the nodes and what roles have been applied to them.

What I've done in the past is to do a "knife node edit" any time I wanted
to add a role or delete a role from a node, or otherwise make changes to
the runlist on a node. But you're right that this information isn't
checked into an SCM anywhere. You could dump the information from a "knife
node show nodename -l" into a file format that could be checked into an
SCM, but most of the information will be auto-discovered by ohai, and you
really want to let ohai do the job you're asking it to do.

For my part, I considered this information about the node itself to be
fairly ephemeral, and the information available from the Chef database
regarding the roles, runlists, and other details about a node has been
sufficient. So long as Chef keeps track of what is applied to what node, I
haven't really cared.

I tried to solve the problem reading the docs, but they are really a
lot and I didn't find anything useful for this :expressionless:

The search interface on docs.opscode.com is decent, but it definitely
has limits. If you know a keyword or two, that's usually enough to get you
to a set of pages, one of which is likely to have information that leads
you to an answer for your question. But if you don't know what you're
looking for, or it's more specific than can be crammed into just a keyword
or two, then you're less likely to be successful.

--
Brad Knowles brad@shub-internet.org
LinkedIn Profile: http://tinyurl.com/y8kpxu

"knife download /nodes" will download all your nodes into your chef-repo

you can also just "knife download /" to get everything which will pull
down nodes, roles, data_bags, cookbooks, environments, acls, clients,
groups, and containers as well...

available in chef-client in 11.6, i think its available for everyone
else in the knife-essentials gem

On 8/8/13 7:31 AM, Brad Knowles wrote:

On Aug 8, 2013, at 8:33 AM, Tommaso Visconti tommaso.visconti@gmail.com wrote:

knife node run_list add "role[cool_role]"

but this doesn't leave any trace in the chef-repo files, so it's impossible to save the associations in the SCM.
Is it possible to use ruby/json files to manage the nodes' roles? Or the only ways are knife and the chef-server web interface?
Well, "knife role from file" will get you the roles themselves stored in a format that you can check into the SCM, but that doesn't help with the information about the nodes and what roles have been applied to them.

What I've done in the past is to do a "knife node edit" any time I wanted to add a role or delete a role from a node, or otherwise make changes to the runlist on a node. But you're right that this information isn't checked into an SCM anywhere. You could dump the information from a "knife node show nodename -l" into a file format that could be checked into an SCM, but most of the information will be auto-discovered by ohai, and you really want to let ohai do the job you're asking it to do.

For my part, I considered this information about the node itself to be fairly ephemeral, and the information available from the Chef database regarding the roles, runlists, and other details about a node has been sufficient. So long as Chef keeps track of what is applied to what node, I haven't really cared.

I tried to solve the problem reading the docs, but they are really a lot and I didn't find anything useful for this :expressionless:
The search interface on docs.opscode.com is decent, but it definitely has limits. If you know a keyword or two, that's usually enough to get you to a set of pages, one of which is likely to have information that leads you to an answer for your question. But if you don't know what you're looking for, or it's more specific than can be crammed into just a keyword or two, then you're less likely to be successful.

--
Brad Knowles brad@shub-internet.org
LinkedIn Profile: http://tinyurl.com/y8kpxu

Thanks for the spiceweasel shoutout, I'm readying the 2.6 release right now which will add the ability to upload nodes if you're storing them as JSON files (Vagrant users requested the feature). It actually handles a pretty wide variety of use cases, the intention has always been to give you a manifest to understand how to deploy/recreate a set of Chef infrastructure. If you don't like YAML you can also use JSON or Ruby formats for your manifests :slight_smile:

Thanks,
Matt Ray
Cloud Integrations Product Lead :: Opscodehttp://opscode.com
512.731.2218 :: matt@opscode.com
mattray :: GitHubhttp://github.com/mattray/ :: IRC :: Twitterhttp://twitter.com/mattray


From: steve . leftathome@gmail.com
Sent: Thursday, August 08, 2013 2:43 PM
To: chef@lists.opscode.com
Cc: Brad Knowles
Subject: [chef] Re: Re: Manage role-node association with scm?

One way of expressing, say, a cluster or group of machines using something SCM-able is to use spiceweasel, which basically converts a YAML file into a bunch of knife commands. Different people seem to use it in different ways (for example, I use it to set up a Chef server with all the objects in a Chef repository for testing), but maybe this will give you some ideas. Or at least a keyword to search against. :wink:

Check it out:

On Thu, Aug 8, 2013 at 7:31 AM, Brad Knowles <brad@shub-internet.orgmailto:brad@shub-internet.org> wrote:
On Aug 8, 2013, at 8:33 AM, Tommaso Visconti <tommaso.visconti@gmail.commailto:tommaso.visconti@gmail.com> wrote:

knife node run_list add "role[cool_role]"

but this doesn't leave any trace in the chef-repo files, so it's impossible to save the associations in the SCM.
Is it possible to use ruby/json files to manage the nodes' roles? Or the only ways are knife and the chef-server web interface?

Well, "knife role from file" will get you the roles themselves stored in a format that you can check into the SCM, but that doesn't help with the information about the nodes and what roles have been applied to them.

What I've done in the past is to do a "knife node edit" any time I wanted to add a role or delete a role from a node, or otherwise make changes to the runlist on a node. But you're right that this information isn't checked into an SCM anywhere. You could dump the information from a "knife node show nodename -l" into a file format that could be checked into an SCM, but most of the information will be auto-discovered by ohai, and you really want to let ohai do the job you're asking it to do.

For my part, I considered this information about the node itself to be fairly ephemeral, and the information available from the Chef database regarding the roles, runlists, and other details about a node has been sufficient. So long as Chef keeps track of what is applied to what node, I haven't really cared.

I tried to solve the problem reading the docs, but they are really a lot and I didn't find anything useful for this :expressionless:

The search interface on docs.opscode.comhttp://docs.opscode.com is decent, but it definitely has limits. If you know a keyword or two, that's usually enough to get you to a set of pages, one of which is likely to have information that leads you to an answer for your question. But if you don't know what you're looking for, or it's more specific than can be crammed into just a keyword or two, then you're less likely to be successful.

--
Brad Knowles <brad@shub-internet.orgmailto:brad@shub-internet.org>
LinkedIn Profile: http://tinyurl.com/y8kpxu

This is great! I was using 11.4 and the node download feature was absent.
I've now a little problem with knife download /, this is the output:

~ knife download /
Created clients
Created nodes
Created users
Created roles/base.json
[...]
ERROR: Errno::ENOENT: No such file or directory - /var/chef/environments

what's knife looking for in that folder? in knife.rb there's no trace of
that path.

Thanks

2013/8/8 Lamont Granquist lamont@opscode.com

"knife download /nodes" will download all your nodes into your chef-repo

http://docs.opscode.com/knife_**download.htmlhttp://docs.opscode.com/knife_download.html

you can also just "knife download /" to get everything which will pull
down nodes, roles, data_bags, cookbooks, environments, acls, clients,
groups, and containers as well...

available in chef-client in 11.6, i think its available for everyone else
in the knife-essentials gem

On 8/8/13 7:31 AM, Brad Knowles wrote:

On Aug 8, 2013, at 8:33 AM, Tommaso Visconti tommaso.visconti@gmail.com
wrote:

knife node run_list add "role[cool_role]"

but this doesn't leave any trace in the chef-repo files, so it's
impossible to save the associations in the SCM.
Is it possible to use ruby/json files to manage the nodes' roles? Or the
only ways are knife and the chef-server web interface?

Well, "knife role from file" will get you the roles themselves stored in
a format that you can check into the SCM, but that doesn't help with the
information about the nodes and what roles have been applied to them.

What I've done in the past is to do a "knife node edit" any time I wanted
to add a role or delete a role from a node, or otherwise make changes to
the runlist on a node. But you're right that this information isn't
checked into an SCM anywhere. You could dump the information from a "knife
node show nodename -l" into a file format that could be checked into an
SCM, but most of the information will be auto-discovered by ohai, and you
really want to let ohai do the job you're asking it to do.

For my part, I considered this information about the node itself to be
fairly ephemeral, and the information available from the Chef database
regarding the roles, runlists, and other details about a node has been
sufficient. So long as Chef keeps track of what is applied to what node, I
haven't really cared.

I tried to solve the problem reading the docs, but they are really a lot

and I didn't find anything useful for this :expressionless:

The search interface on docs.opscode.com is decent, but it definitely
has limits. If you know a keyword or two, that's usually enough to get you
to a set of pages, one of which is likely to have information that leads
you to an answer for your question. But if you don't know what you're
looking for, or it's more specific than can be crammed into just a keyword
or two, then you're less likely to be successful.

--
Brad Knowles brad@shub-internet.org
LinkedIn Profile: http://tinyurl.com/y8kpxu

By the way, I've been using the ruby manifests and its great cause I can use ruby in the manifests :slight_smile: I.e. I can have blocks of ruby before the main manifest attributes to build up hashes and then use them in the spice weasel sections. Both as pure ruby and thru ruby string interpolation.

This is especially helpful for passing in json blobs to set chef override attributes instead of or in addition to using roles.

So a "preamble" section sets up a bunch of global and specific overrides:

"Global" attributes that should be applied to all nodes

cluster_attributes = {
:cluster_name => "qa00"
}

Hash of each attributed override for each node

overrides = {

The pod Node

:pod_attributes => {
:pod => "default",
:haproxy => {
:balance_algorithm => "hdr(X-Real-IP)",
:defaults_options => [
"httplog",
"dontlognull",
"forwardfor",
"redispatch",
"httpchk GET /ui/"
]
},
:logstash => {
:awesant=> {
:inputs => [
{:file =>{
:type => 'secure',
:path => '/var/log/secure',
} }
]
}
}
},

The cluster nodes

:cluster_attributes => {},

The engine app nodes

:engine_attributes => {}
}

Merge the cluster level overrides into the individual overrides

overrides.each_pair { |k,v| overrides[k].merge!(cluster_attributes) }

Then in the spice weasel section I can say things like #{overrides[:pod_attributes].to_json} to set the Json attributes passed into the chef run:

"clusters"=>
[
{
"qa"=>
[
{
"ec2 1"=>
{
"run_list"=>"role[pod] recipe[pod] recipe[logstash::awesant]",
"options"=>
"-d chef-full -S qa00-east1 -G qa00 -I ami-ac6d9172 -f m1.medium -j '#{overrides[:pod_attributes].to_json}' -N qa_plb{{n}}.app.example.com"
}
},
...


Robert J Berger +1 408-838-8896
Internet Bandwidth Development, LLC
http://www.linkedin.com/in/rberger

On Aug 9, 2013, at 10:13 AM, Matt Ray matt@opscode.com wrote:

Thanks for the spiceweasel shoutout, I'm readying the 2.6 release right now which will add the ability to upload nodes if you're storing them as JSON files (Vagrant users requested the feature). It actually handles a pretty wide variety of use cases, the intention has always been to give you a manifest to understand how to deploy/recreate a set of Chef infrastructure. If you don't like YAML you can also use JSON or Ruby formats for your manifests :slight_smile:

Thanks,
Matt Ray
Cloud Integrations Product Lead :: Opscode
512.731.2218 :: matt@opscode.com
mattray :: GitHub :: IRC :: Twitter

From: steve . leftathome@gmail.com
Sent: Thursday, August 08, 2013 2:43 PM
To: chef@lists.opscode.com
Cc: Brad Knowles
Subject: [chef] Re: Re: Manage role-node association with scm?

One way of expressing, say, a cluster or group of machines using something SCM-able is to use spiceweasel, which basically converts a YAML file into a bunch of knife commands. Different people seem to use it in different ways (for example, I use it to set up a Chef server with all the objects in a Chef repository for testing), but maybe this will give you some ideas. Or at least a keyword to search against. :wink:

Check it out:

GitHub - mattray/spiceweasel: Generates Chef knife commands from a simple JSON or YAML file.

On Thu, Aug 8, 2013 at 7:31 AM, Brad Knowles brad@shub-internet.org wrote:
On Aug 8, 2013, at 8:33 AM, Tommaso Visconti tommaso.visconti@gmail.com wrote:

knife node run_list add "role[cool_role]"

but this doesn't leave any trace in the chef-repo files, so it's impossible to save the associations in the SCM.
Is it possible to use ruby/json files to manage the nodes' roles? Or the only ways are knife and the chef-server web interface?

Well, "knife role from file" will get you the roles themselves stored in a format that you can check into the SCM, but that doesn't help with the information about the nodes and what roles have been applied to them.

What I've done in the past is to do a "knife node edit" any time I wanted to add a role or delete a role from a node, or otherwise make changes to the runlist on a node. But you're right that this information isn't checked into an SCM anywhere. You could dump the information from a "knife node show nodename -l" into a file format that could be checked into an SCM, but most of the information will be auto-discovered by ohai, and you really want to let ohai do the job you're asking it to do.

For my part, I considered this information about the node itself to be fairly ephemeral, and the information available from the Chef database regarding the roles, runlists, and other details about a node has been sufficient. So long as Chef keeps track of what is applied to what node, I haven't really cared.

I tried to solve the problem reading the docs, but they are really a lot and I didn't find anything useful for this :expressionless:

The search interface on docs.opscode.com is decent, but it definitely has limits. If you know a keyword or two, that's usually enough to get you to a set of pages, one of which is likely to have information that leads you to an answer for your question. But if you don't know what you're looking for, or it's more specific than can be crammed into just a keyword or two, then you're less likely to be successful.

--
Brad Knowles brad@shub-internet.org
LinkedIn Profile: http://tinyurl.com/y8kpxu

i think you need to set cookbook_path, role_path, data_bag_path and
environment_path in your knife.rb, i think you're missing
environment_path. even if you don't use environments you'll still get
_default downloaded.

On 8/9/13 2:07 AM, Tommaso Visconti wrote:

This is great! I was using 11.4 and the node download feature was absent.
I've now a little problem with knife download /, this is the output:

~ knife download /
Created clients
Created nodes
Created users
Created roles/base.json
[...]
ERROR: Errno::ENOENT: No such file or directory - /var/chef/environments

what's knife looking for in that folder? in knife.rb there's no trace
of that path.

Thanks

2013/8/8 Lamont Granquist <lamont@opscode.com mailto:lamont@opscode.com>

"knife download /nodes" will download all your nodes into your
chef-repo

http://docs.opscode.com/knife_download.html

you can also just "knife download /" to get everything which will
pull down nodes, roles, data_bags, cookbooks, environments, acls,
clients, groups, and containers as well...

available in chef-client in 11.6, i think its available for
everyone else in the knife-essentials gem


On 8/8/13 7:31 AM, Brad Knowles wrote:

    On Aug 8, 2013, at 8:33 AM, Tommaso Visconti
    <tommaso.visconti@gmail.com
    <mailto:tommaso.visconti@gmail.com>> wrote:

        knife node run_list add <mynode> "role[cool_role]"

        but this doesn't leave any trace in the chef-repo files,
        so it's impossible to save the associations in the SCM.
        Is it possible to use ruby/json files to manage the nodes'
        roles? Or the only ways are knife and the chef-server web
        interface?

    Well, "knife role from file" will get you the roles themselves
    stored in a format that you can check into the SCM, but that
    doesn't help with the information about the nodes and what
    roles have been applied to them.

    What I've done in the past is to do a "knife node edit" any
    time I wanted to add a role or delete a role from a node, or
    otherwise make changes to the runlist on a node.  But you're
    right that this information isn't checked into an SCM
    anywhere.  You could dump the information from a "knife node
    show nodename -l" into a file format that could be checked
    into an SCM, but most of the information will be
    auto-discovered by ohai, and you really want to let ohai do
    the job you're asking it to do.


    For my part, I considered this information about the node
    itself to be fairly ephemeral, and the information available
    from the Chef database regarding the roles, runlists, and
    other details about a node has been sufficient.  So long as
    Chef keeps track of what is applied to what node, I haven't
    really cared.

        I tried to solve the problem reading the docs, but they
        are really a lot and I didn't find anything useful for this :|

    The search interface on docs.opscode.com
    <http://docs.opscode.com> is decent, but it definitely has
    limits.  If you know a keyword or two, that's usually enough
    to get you to a set of pages, one of which is likely to have
    information that leads you to an answer for your question.
     But if you don't know what you're looking for, or it's more
    specific than can be crammed into just a keyword or two, then
    you're less likely to be successful.

    --
    Brad Knowles <brad@shub-internet.org
    <mailto:brad@shub-internet.org>>
    LinkedIn Profile: <http://tinyurl.com/y8kpxu>

If your nodes are static (vs. elastic) you could also use a Vagrantfile to
represent your nodes.

Cheers, Torben

On Fri, Aug 9, 2013 at 6:18 PM, Lamont Granquist lamont@opscode.com wrote:

i think you need to set cookbook_path, role_path, data_bag_path and
environment_path in your knife.rb, i think you're missing
environment_path. even if you don't use environments you'll still get
_default downloaded.

On 8/9/13 2:07 AM, Tommaso Visconti wrote:

This is great! I was using 11.4 and the node download feature was absent.
I've now a little problem with knife download /, this is the output:

~ knife download /
Created clients
Created nodes
Created users
Created roles/base.json
[...]
ERROR: Errno::ENOENT: No such file or directory - /var/chef/environments

what's knife looking for in that folder? in knife.rb there's no trace of
that path.

Thanks

2013/8/8 Lamont Granquist lamont@opscode.com

"knife download /nodes" will download all your nodes into your chef-repo

knife download

you can also just "knife download /" to get everything which will pull
down nodes, roles, data_bags, cookbooks, environments, acls, clients,
groups, and containers as well...

available in chef-client in 11.6, i think its available for everyone else
in the knife-essentials gem

On 8/8/13 7:31 AM, Brad Knowles wrote:

On Aug 8, 2013, at 8:33 AM, Tommaso Visconti tommaso.visconti@gmail.com
wrote:

knife node run_list add "role[cool_role]"

but this doesn't leave any trace in the chef-repo files, so it's
impossible to save the associations in the SCM.
Is it possible to use ruby/json files to manage the nodes' roles? Or
the only ways are knife and the chef-server web interface?

Well, "knife role from file" will get you the roles themselves stored in
a format that you can check into the SCM, but that doesn't help with the
information about the nodes and what roles have been applied to them.

What I've done in the past is to do a "knife node edit" any time I
wanted to add a role or delete a role from a node, or otherwise make
changes to the runlist on a node. But you're right that this information
isn't checked into an SCM anywhere. You could dump the information from a
"knife node show nodename -l" into a file format that could be checked into
an SCM, but most of the information will be auto-discovered by ohai, and
you really want to let ohai do the job you're asking it to do.

For my part, I considered this information about the node itself to be
fairly ephemeral, and the information available from the Chef database
regarding the roles, runlists, and other details about a node has been
sufficient. So long as Chef keeps track of what is applied to what node, I
haven't really cared.

I tried to solve the problem reading the docs, but they are really a

lot and I didn't find anything useful for this :expressionless:

The search interface on docs.opscode.com is decent, but it definitely
has limits. If you know a keyword or two, that's usually enough to get you
to a set of pages, one of which is likely to have information that leads
you to an answer for your question. But if you don't know what you're
looking for, or it's more specific than can be crammed into just a keyword
or two, then you're less likely to be successful.

--
Brad Knowles brad@shub-internet.org
LinkedIn Profile: http://tinyurl.com/y8kpxu

yes, well spotted! thanks :slight_smile:

2013/8/9 Lamont Granquist lamont@opscode.com

i think you need to set cookbook_path, role_path, data_bag_path and
environment_path in your knife.rb, i think you're missing
environment_path. even if you don't use environments you'll still get
_default downloaded.

On 8/9/13 2:07 AM, Tommaso Visconti wrote:

This is great! I was using 11.4 and the node download feature was absent.
I've now a little problem with knife download /, this is the output:

~ knife download /
Created clients
Created nodes
Created users
Created roles/base.json
[...]
ERROR: Errno::ENOENT: No such file or directory - /var/chef/environments

what's knife looking for in that folder? in knife.rb there's no trace of
that path.

Thanks

2013/8/8 Lamont Granquist lamont@opscode.com

"knife download /nodes" will download all your nodes into your chef-repo

knife download

you can also just "knife download /" to get everything which will pull
down nodes, roles, data_bags, cookbooks, environments, acls, clients,
groups, and containers as well...

available in chef-client in 11.6, i think its available for everyone else
in the knife-essentials gem

On 8/8/13 7:31 AM, Brad Knowles wrote:

On Aug 8, 2013, at 8:33 AM, Tommaso Visconti tommaso.visconti@gmail.com
wrote:

knife node run_list add "role[cool_role]"

but this doesn't leave any trace in the chef-repo files, so it's
impossible to save the associations in the SCM.
Is it possible to use ruby/json files to manage the nodes' roles? Or
the only ways are knife and the chef-server web interface?

Well, "knife role from file" will get you the roles themselves stored in
a format that you can check into the SCM, but that doesn't help with the
information about the nodes and what roles have been applied to them.

What I've done in the past is to do a "knife node edit" any time I
wanted to add a role or delete a role from a node, or otherwise make
changes to the runlist on a node. But you're right that this information
isn't checked into an SCM anywhere. You could dump the information from a
"knife node show nodename -l" into a file format that could be checked into
an SCM, but most of the information will be auto-discovered by ohai, and
you really want to let ohai do the job you're asking it to do.

For my part, I considered this information about the node itself to be
fairly ephemeral, and the information available from the Chef database
regarding the roles, runlists, and other details about a node has been
sufficient. So long as Chef keeps track of what is applied to what node, I
haven't really cared.

I tried to solve the problem reading the docs, but they are really a

lot and I didn't find anything useful for this :expressionless:

The search interface on docs.opscode.com is decent, but it definitely
has limits. If you know a keyword or two, that's usually enough to get you
to a set of pages, one of which is likely to have information that leads
you to an answer for your question. But if you don't know what you're
looking for, or it's more specific than can be crammed into just a keyword
or two, then you're less likely to be successful.

--
Brad Knowles brad@shub-internet.org
LinkedIn Profile: http://tinyurl.com/y8kpxu