How/can I update a node's attributes via knife WITHOUT bootstrapping


#1

I’m aware of the -j option to set node attributes during bootstrap. I’m also aware of knife edit, which is needs user input form an editor. This is NOT what I’m talking about

If a node is already bootstrapped, how can I set some of its attributes without re-bootstrapping it, and not using knife edit. I know I can do the following in a script since I want to do this automagically.

  •    Knife ode show -Fj > node.json
    
  •    Edit the node.json file
    
  •    Knife node from file node.json
    

Is there a more elegant way?


#2

How about a recipe and setting the attribute as ‘normal’? Would that work
for you?

Sebastian Garcia

System Network Engineer

Smart Trade Technologies420 Lexington Ave. Ste. 2800-02
New York, NY 10170
212-867-4567 x90
http://www.smart-trade.net

On Fri, May 8, 2015 at 2:47 PM, Fouts, Chris Chris.Fouts@sensus.com wrote:

I’m aware of the -j option to set node attributes during bootstrap. I’m
also aware of knife edit, which is needs user input form an editor. This is
NOT what I’m talking about

If a node is already bootstrapped, how can I set some of its attributes
without re-bootstrapping it, and not using knife edit. I know I can do the
following in a script since I want to do this automagically.

  •    Knife ode show –Fj > node.json
    
  •    Edit the node.json file
    
  •    Knife node from file node.json
    

Is there a more elegant way?


#3

We wrote our own knife plugin a few years ago but since then several have popped up on github, A quick search revealed:



This is by no means complete or an endorsement of any of these.

Joe

On May 8, 2015, at 11:47 AM, Fouts, Chris Chris.Fouts@Sensus.com wrote:

I’m aware of the -j option to set node attributes during bootstrap. I’m also aware of knife edit, which is needs user input form an editor. This is NOT what I’m talking about

If a node is already bootstrapped, how can I set some of its attributes without re-bootstrapping it, and not using knife edit. I know I can do the following in a script since I want to do this automagically.

  •    Knife ode show –Fj > node.json
    
  •    Edit the node.json file
    
  •    Knife node from file node.json
    

Is there a more elegant way?


#4

Excellent idea! Thanks.

Chris

From: Sebastian Garcia [mailto:sgarcia@smart-trade.net]
Sent: Friday, May 08, 2015 3:01 PM
To: chef@lists.opscode.com
Subject: [chef] Re: How/can I update a node’s attributes via knife WITHOUT bootstrapping

How about a recipe and setting the attribute as ‘normal’? Would that work for you?

Sebastian Garcia

System Network Engineer
Smart Trade Technologies
420 Lexington Ave. Ste. 2800-02
New York, NY 10170
212-867-4567 x90
http://www.smart-trade.nethttp://www.smart-trade.net/

On Fri, May 8, 2015 at 2:47 PM, Fouts, Chris <Chris.Fouts@sensus.commailto:Chris.Fouts@sensus.com> wrote:
I’m aware of the -j option to set node attributes during bootstrap. I’m also aware of knife edit, which is needs user input form an editor. This is NOT what I’m talking about

If a node is already bootstrapped, how can I set some of its attributes without re-bootstrapping it, and not using knife edit. I know I can do the following in a script since I want to do this automagically.

  •    Knife ode show –Fj > node.json
    
  •    Edit the node.json file
    
  •    Knife node from file node.json
    

Is there a more elegant way?


#5

Thanks, I’ll look into these plugins.

Chris

From: Joe Nuspl [mailto:nuspl@nvwls.com]
Sent: Friday, May 08, 2015 3:03 PM
To: chef@lists.opscode.com
Subject: [chef] Re: How/can I update a node’s attributes via knife WITHOUT bootstrapping

We wrote our own knife plugin a few years ago but since then several have popped up on github, A quick search revealed:



This is by no means complete or an endorsement of any of these.

        Joe

On May 8, 2015, at 11:47 AM, Fouts, Chris <Chris.Fouts@Sensus.commailto:Chris.Fouts@Sensus.com> wrote:

I’m aware of the -j option to set node attributes during bootstrap. I’m also aware of knife edit, which is needs user input form an editor. This is NOT what I’m talking about

If a node is already bootstrapped, how can I set some of its attributes without re-bootstrapping it, and not using knife edit. I know I can do the following in a script since I want to do this automagically.

  •    Knife ode show -Fj > node.json
    
  •    Edit the node.json file
    
  •    Knife node from file node.json
    

Is there a more elegant way?


#6

Hi,
I use knife exec to update attributes values.
Something like this:
knife exec -E 'nodes.find(:name => “node_name”) {|n| n.set[attribute_name]
= attribute_value ; n.save }
Hope it helps
Michel

On Mon, May 11, 2015 at 1:07 PM, Fouts, Chris Chris.Fouts@sensus.com
wrote:

Thanks, I’ll look into these plugins.

Chris

From: Joe Nuspl [mailto:nuspl@nvwls.com]
Sent: Friday, May 08, 2015 3:03 PM
To: chef@lists.opscode.com
Subject: [chef] Re: How/can I update a node’s attributes via knife
WITHOUT bootstrapping

We wrote our own knife plugin a few years ago but since then several have
popped up on github, A quick search revealed:

https://github.com/mrtazz/knife-node-attribute

https://github.com/amian84/knife-set-attribute

https://github.com/pdf/knife-attribute

This is by no means complete or an endorsement of any of these.

        Joe

On May 8, 2015, at 11:47 AM, Fouts, Chris Chris.Fouts@Sensus.com wrote:

I’m aware of the -j option to set node attributes during bootstrap. I’m
also aware of knife edit, which is needs user input form an editor. This is
NOT what I’m talking about

If a node is already bootstrapped, how can I set some of its attributes
without re-bootstrapping it, and not using knife edit. I know I can do the
following in a script since I want to do this automagically.

  •    Knife ode show –Fj > node.json
    
  •    Edit the node.json file
    
  •    Knife node from file node.json
    

Is there a more elegant way?


#7

Thanks, another good answer.

Chris

From: Michel Blankleder [mailto:michel.blankleder@gmail.com]
Sent: Monday, May 11, 2015 12:22 PM
To: chef@lists.opscode.com
Subject: [chef] Re: RE: Re: How/can I update a node’s attributes via knife WITHOUT bootstrapping

Hi,
I use knife exec to update attributes values.
Something like this:
knife exec -E 'nodes.find(:name => “node_name”) {|n| n.set[attribute_name] = attribute_value ; n.save }
Hope it helps
Michel

On Mon, May 11, 2015 at 1:07 PM, Fouts, Chris <Chris.Fouts@sensus.commailto:Chris.Fouts@sensus.com> wrote:
Thanks, I’ll look into these plugins.

Chris

From: Joe Nuspl [mailto:nuspl@nvwls.commailto:nuspl@nvwls.com]
Sent: Friday, May 08, 2015 3:03 PM
To: chef@lists.opscode.commailto:chef@lists.opscode.com
Subject: [chef] Re: How/can I update a node’s attributes via knife WITHOUT bootstrapping

We wrote our own knife plugin a few years ago but since then several have popped up on github, A quick search revealed:



This is by no means complete or an endorsement of any of these.

        Joe

On May 8, 2015, at 11:47 AM, Fouts, Chris <Chris.Fouts@Sensus.commailto:Chris.Fouts@Sensus.com> wrote:

I’m aware of the -j option to set node attributes during bootstrap. I’m also aware of knife edit, which is needs user input form an editor. This is NOT what I’m talking about

If a node is already bootstrapped, how can I set some of its attributes without re-bootstrapping it, and not using knife edit. I know I can do the following in a script since I want to do this automagically.

  •    Knife ode show –Fj > node.json
    
  •    Edit the node.json file
    
  •    Knife node from file node.json
    

Is there a more elegant way?