Pass an attrribute in the knife bootstrap command


#1

Is there a way to pass an attribute in the knife bootstrap command?

For example, I have a role that has a recipe to partition and format
disks differently on the master node as opposed to the data nodes. The
recipe has a default attribute set for a data node.

I would like to override that default attribute with the knife bootstrap
command (which also installs ruby, the chef-client and configures the
client).

Any ideas?

Randy


#2

Create a new role that overrides the attribute and includes the normal
role in it’s runlist. Then assign your master node that role instead
of the other. Would that work for you?

Jake.

On Tue, Nov 29, 2011 at 5:01 PM, Van Fossan,Randy vanfossr@oclc.org wrote:

Is there a way to pass an attribute in the knife bootstrap command?

For example, I have a role that has a recipe to partition and format
disks differently on the master node as opposed to the data nodes. The
recipe has a default attribute set for a data node.

I would like to override that default attribute with the knife bootstrap
command (which also installs ruby, the chef-client and configures the
client).

Any ideas?

Randy


#3

Jake,

Yes, that would work and was my fallback plan. I was just trying to be more efficient. Also, since the last recipe removes the role from the runlist, I will now have to deal with 2 roles.

Thanks
Randy

-----Original Message-----
From: Jake Vanderdray [mailto:jvanderdray@customink.com]
Sent: Wednesday, November 30, 2011 11:04 AM
To: chef@lists.opscode.com
Subject: [chef] Re: Pass an attrribute in the knife bootstrap command

Create a new role that overrides the attribute and includes the normal role in it’s runlist. Then assign your master node that role instead of the other. Would that work for you?

Jake.

On Tue, Nov 29, 2011 at 5:01 PM, Van Fossan,Randy vanfossr@oclc.org wrote:

Is there a way to pass an attribute in the knife bootstrap command?

For example, I have a role that has a recipe to partition and format
disks differently on the master node as opposed to the data nodes.
The recipe has a default attribute set for a data node.

I would like to override that default attribute with the knife
bootstrap command (which also installs ruby, the chef-client and
configures the client).

Any ideas?

Randy


#4

My 2 cents: I would also like to be able to set tags for a node via knife
bootstrap.

-chris

On Mon, Dec 5, 2011 at 1:51 PM, Van Fossan,Randy vanfossr@oclc.org wrote:

Jake,

Yes, that would work and was my fallback plan. I was just trying to be
more efficient. Also, since the last recipe removes the role from the
runlist, I will now have to deal with 2 roles.

Thanks
Randy

-----Original Message-----
From: Jake Vanderdray [mailto:jvanderdray@customink.com]
Sent: Wednesday, November 30, 2011 11:04 AM
To: chef@lists.opscode.com
Subject: [chef] Re: Pass an attrribute in the knife bootstrap command

Create a new role that overrides the attribute and includes the normal
role in it’s runlist. Then assign your master node that role instead of
the other. Would that work for you?

Jake.

On Tue, Nov 29, 2011 at 5:01 PM, Van Fossan,Randy vanfossr@oclc.org
wrote:

Is there a way to pass an attribute in the knife bootstrap command?

For example, I have a role that has a recipe to partition and format
disks differently on the master node as opposed to the data nodes.
The recipe has a default attribute set for a data node.

I would like to override that default attribute with the knife
bootstrap command (which also installs ruby, the chef-client and
configures the client).

Any ideas?

Randy


#5

Its kludgy, but you could easily script (either via a knife plugin or a
shell script) a series of: create role with desired attr, bootstrap host
with said role in run list, remove role from run list on newly-created
nose, delete role.

Or you could modify the bootstrap template, which ultimately builds a blob
of JSON to feed to the initial chef-client run. You’d still need to get
the extra attr from the command line into the template render, though. A
custom plugin would be cleanest but you could also fake it with nonce
environment variables (CHEF_EXTRA=value knife bootstrap …).

On Monday, December 5, 2011, Chris Walters cwalters@gmail.com wrote:

My 2 cents: I would also like to be able to set tags for a node via knife
bootstrap.
-chris

On Mon, Dec 5, 2011 at 1:51 PM, Van Fossan,Randy vanfossr@oclc.org
wrote:

Jake,

Yes, that would work and was my fallback plan. I was just trying to be
more efficient. Also, since the last recipe removes the role from the
runlist, I will now have to deal with 2 roles.

Thanks
Randy

-----Original Message-----
From: Jake Vanderdray [mailto:jvanderdray@customink.com]
Sent: Wednesday, November 30, 2011 11:04 AM
To: chef@lists.opscode.com
Subject: [chef] Re: Pass an attrribute in the knife bootstrap command

Create a new role that overrides the attribute and includes the normal
role in it’s runlist. Then assign your master node that role instead of
the other. Would that work for you?

Jake.

On Tue, Nov 29, 2011 at 5:01 PM, Van Fossan,Randy vanfossr@oclc.org
wrote:

Is there a way to pass an attribute in the knife bootstrap command?

For example, I have a role that has a recipe to partition and format
disks differently on the master node as opposed to the data nodes.
The recipe has a default attribute set for a data node.

I would like to override that default attribute with the knife
bootstrap command (which also installs ruby, the chef-client and
configures the client).

Any ideas?

Randy


Mark J. Reed markjreed@gmail.com


#6

Its kludgy, but you could easily script (either via a knife plugin or a
shell script) a series of: create role with desired attr, bootstrap host
with said role in run list, remove role from run list on newly-created
nose, delete role.

Or you could modify the bootstrap template, which ultimately builds a blob
of JSON to feed to the initial chef-client run. You’d still need to get
the extra attr from the command line into the template render, though. A
custom plugin would be cleanest but you could also fake it with nonce
environment variables (CHEF_EXTRA=value knife bootstrap …).

On Monday, December 5, 2011, Chris Walters cwalters@gmail.com wrote:

My 2 cents: I would also like to be able to set tags for a node via knife
bootstrap.
-chris

On Mon, Dec 5, 2011 at 1:51 PM, Van Fossan,Randy vanfossr@oclc.org
wrote:

Jake,

Yes, that would work and was my fallback plan. I was just trying to be
more efficient. Also, since the last recipe removes the role from the
runlist, I will now have to deal with 2 roles.

Thanks
Randy

-----Original Message-----
From: Jake Vanderdray [mailto:jvanderdray@customink.com]
Sent: Wednesday, November 30, 2011 11:04 AM
To: chef@lists.opscode.com
Subject: [chef] Re: Pass an attrribute in the knife bootstrap command

Create a new role that overrides the attribute and includes the normal
role in it’s runlist. Then assign your master node that role instead of
the other. Would that work for you?

Jake.

On Tue, Nov 29, 2011 at 5:01 PM, Van Fossan,Randy vanfossr@oclc.org
wrote:

Is there a way to pass an attribute in the knife bootstrap command?

For example, I have a role that has a recipe to partition and format
disks differently on the master node as opposed to the data nodes.
The recipe has a default attribute set for a data node.

I would like to override that default attribute with the knife
bootstrap command (which also installs ruby, the chef-client and
configures the client).

Any ideas?

Randy


Mark J. Reed markjreed@gmail.com