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

**URL:** <https://discourse.chef.io/t/how-can-i-update-a-nodes-attributes-via-knife-without-bootstrapping/6642>\
**Category:** Chef Infra (archive)\
**Created:** [May 8, 2015, 6:47pm UTC](https://discourse.chef.io/t/how-can-i-update-a-nodes-attributes-via-knife-without-bootstrapping/6642 "2015-05-08T18:47:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_F](https://avatars.discourse-cdn.com/v4/letter/c/fbc32d/32.png) [@Chris\_F](https://discourse.chef.io/u/Chris_F)\
**Post date:** [May 8, 2015, 6:47pm UTC](https://discourse.chef.io/t/how-can-i-update-a-nodes-attributes-via-knife-without-bootstrapping/6642/1 "2015-05-08T18:47:31Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Sebastian\_Garcia](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@Sebastian\_Garcia](https://discourse.chef.io/u/Sebastian_Garcia)\
**Post date:** [May 8, 2015, 7:00pm UTC](https://discourse.chef.io/t/how-can-i-update-a-nodes-attributes-via-knife-without-bootstrapping/6642/2 "2015-05-08T19:00:51Z")

</div>

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

> **[Electronic trading platforms for buy-side and sell-side - smartTrade](https://smart-trade.net/)**
>
> smartTrade Technologies is a leading global provider with multi-asset electronic trading platforms, helping buy-side & sell-side institutions

On Fri, May 8, 2015 at 2:47 PM, Fouts, Chris [Chris.Fouts@sensus.com](mailto: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?

---

<div class="post-metadata">

**Author:** ![Joe\_Nuspl](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/joe_nuspl/32/3243_2.png) [@Joe\_Nuspl](https://discourse.chef.io/u/Joe_Nuspl)\
**Post date:** [May 8, 2015, 7:03pm UTC](https://discourse.chef.io/t/how-can-i-update-a-nodes-attributes-via-knife-without-bootstrapping/6642/3 "2015-05-08T19:03:29Z")

</div>

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

> **[GitHub - mrtazz/knife-node-attribute: knife plugin to show and delete node...](https://github.com/mrtazz/knife-node-attribute)**
>
> knife plugin to show and delete node attributes. Contribute to mrtazz/knife-node-attribute development by creating an account on GitHub.

> **[GitHub - amian84/knife-set-attribute: Knife set\_attribute is a plugin to...](https://github.com/amian84/knife-set-attribute)**
>
> Knife set\_attribute is a plugin to knife to change attributes values in your nodes - GitHub - amian84/knife-set-attribute: Knife set\_attribute is a plugin to knife to change attributes values in yo...

> **[GitHub - pdf/knife-attribute: Manipulate Chef attributes via Knife](https://github.com/pdf/knife-attribute)**
>
> Manipulate Chef attributes via Knife. Contribute to pdf/knife-attribute development by creating an account on GitHub.

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](mailto: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?

---

<div class="post-metadata">

**Author:** ![Chris\_F](https://avatars.discourse-cdn.com/v4/letter/c/fbc32d/32.png) [@Chris\_F](https://discourse.chef.io/u/Chris_F)\
**Post date:** [May 8, 2015, 7:27pm UTC](https://discourse.chef.io/t/how-can-i-update-a-nodes-attributes-via-knife-without-bootstrapping/6642/4 "2015-05-08T19:27:31Z")

</div>

Excellent idea! Thanks.

Chris

From: Sebastian Garcia [[mailto:sgarcia@smart-trade.net](mailto:sgarcia@smart-trade.net)]  
Sent: Friday, May 08, 2015 3:01 PM  
To: [chef@lists.opscode.com](mailto: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.net](http://www.smart-trade.net)[http://www.smart-trade.net/](http://www.smart-trade.net/)

On Fri, May 8, 2015 at 2:47 PM, Fouts, Chris \<[Chris.Fouts@sensus.com](mailto:Chris.Fouts@sensus.com)[mailto:Chris.Fouts@sensus.com](mailto: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?

---

<div class="post-metadata">

**Author:** ![Chris\_F](https://avatars.discourse-cdn.com/v4/letter/c/fbc32d/32.png) [@Chris\_F](https://discourse.chef.io/u/Chris_F)\
**Post date:** [May 11, 2015, 4:07pm UTC](https://discourse.chef.io/t/how-can-i-update-a-nodes-attributes-via-knife-without-bootstrapping/6642/5 "2015-05-11T16:07:48Z")

</div>

Thanks, I’ll look into these plugins.

Chris

From: Joe Nuspl [[mailto:nuspl@nvwls.com](mailto:nuspl@nvwls.com)]  
Sent: Friday, May 08, 2015 3:03 PM  
To: [chef@lists.opscode.com](mailto: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:

> **[mrtazz/knife-node-attribute](https://github.com/mrtazz/knife-node-attribute)**
>
> knife-node-attribute - knife plugin to show and delete node attributes

  

> **[amian84/knife-set-attribute](https://github.com/amian84/knife-set-attribute)**
>
> knife-set-attribute - Knife set\_attribute is a plugin to knife to change attributes values in your nodes

  

> **[pdf/knife-attribute](https://github.com/pdf/knife-attribute)**
>
> knife-attribute - Manipulate Chef attributes via Knife

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](mailto:Chris.Fouts@Sensus.com)[mailto:Chris.Fouts@Sensus.com](mailto: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?

---

<div class="post-metadata">

**Author:** ![Michel\_Blankleder](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/michel_blankleder/32/120_2.png) [@Michel\_Blankleder](https://discourse.chef.io/u/Michel_Blankleder)\
**Post date:** [May 11, 2015, 4:21pm UTC](https://discourse.chef.io/t/how-can-i-update-a-nodes-attributes-via-knife-without-bootstrapping/6642/6 "2015-05-11T16:21:59Z")

</div>

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](mailto:Chris.Fouts@sensus.com)  
wrote:

> Thanks, I’ll look into these plugins.
> 
> Chris
> 
> _From:_ Joe Nuspl [[mailto:nuspl@nvwls.com](mailto:nuspl@nvwls.com)]  
> _Sent:_ Friday, May 08, 2015 3:03 PM  
> _To:_ [chef@lists.opscode.com](mailto: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:
> 
> [GitHub - mrtazz/knife-node-attribute: knife plugin to show and delete node attributes](https://github.com/mrtazz/knife-node-attribute)
> 
> [GitHub - amian84/knife-set-attribute: Knife set\_attribute is a plugin to knife to change attributes values in your nodes](https://github.com/amian84/knife-set-attribute)
> 
> [GitHub - pdf/knife-attribute: Manipulate Chef attributes via Knife](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](mailto: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?

---

<div class="post-metadata">

**Author:** ![Chris\_F](https://avatars.discourse-cdn.com/v4/letter/c/fbc32d/32.png) [@Chris\_F](https://discourse.chef.io/u/Chris_F)\
**Post date:** [May 11, 2015, 8:27pm UTC](https://discourse.chef.io/t/how-can-i-update-a-nodes-attributes-via-knife-without-bootstrapping/6642/7 "2015-05-11T20:27:15Z")

</div>

Thanks, another good answer.

Chris

From: Michel Blankleder [[mailto:michel.blankleder@gmail.com](mailto:michel.blankleder@gmail.com)]  
Sent: Monday, May 11, 2015 12:22 PM  
To: [chef@lists.opscode.com](mailto: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.com](mailto:Chris.Fouts@sensus.com)[mailto:Chris.Fouts@sensus.com](mailto:Chris.Fouts@sensus.com)\> wrote:  
Thanks, I’ll look into these plugins.

Chris

From: Joe Nuspl [[mailto:nuspl@nvwls.com](mailto:nuspl@nvwls.com)[mailto:nuspl@nvwls.com](mailto:nuspl@nvwls.com)]  
Sent: Friday, May 08, 2015 3:03 PM  
To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)[mailto:chef@lists.opscode.com](mailto: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:

> **[mrtazz/knife-node-attribute](https://github.com/mrtazz/knife-node-attribute)**
>
> knife-node-attribute - knife plugin to show and delete node attributes

  

> **[amian84/knife-set-attribute](https://github.com/amian84/knife-set-attribute)**
>
> knife-set-attribute - Knife set\_attribute is a plugin to knife to change attributes values in your nodes

  

> **[pdf/knife-attribute](https://github.com/pdf/knife-attribute)**
>
> knife-attribute - Manipulate Chef attributes via Knife

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](mailto:Chris.Fouts@Sensus.com)[mailto:Chris.Fouts@Sensus.com](mailto: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?
