How to translate file from nodes to Chef server?

Hi,

Is there anyway to get files from each nodes to Chef server?
I need to collect conf files from nodes and then manage them.

Thanks in advance.

Tetsu

On Feb 13, 2012, at 8:29 AM, tetsu soh wrote:

Is there anyway to get files from each nodes to Chef server?
I need to collect conf files from nodes and then manage them.

Have each node commit updates to their files to a central code repository server, like git & maybe github or your own private git server?

--
Brad Knowles bknowles@ihiji.com
SAGE Level IV, Chef Level 0.0.1

Hi,

you could also save the content of the config file as an attribute value,
then store the content to a file on the chef server and set the attributes
to nil afterwards.
However committing them to a git or svn server seems to be better suited
for the job. For commit rights to a svn server you could use the existing
Chef client certificates if you dislike anonymous commits. Not sure if git
also provides a ssl certificate based frontend.

Cheers,

Oscar

On Mon, Feb 13, 2012 at 4:54 PM, Brad Knowles bknowles@ihiji.com wrote:

On Feb 13, 2012, at 8:29 AM, tetsu soh wrote:

Is there anyway to get files from each nodes to Chef server?
I need to collect conf files from nodes and then manage them.

Have each node commit updates to their files to a central code repository
server, like git & maybe github or your own private git server?

--
Brad Knowles bknowles@ihiji.com
SAGE Level IV, Chef Level 0.0.1

Hi,

Thank you for your solution.

For committing to central version control system, git or svn client is required for each node. It may be hard in my case. Another problem is the burden to the vcs. Number of nodes is huge.

I'm interesting on the approach to save conf as key/value. Could you detail this? how can I save attribute from nodes to Chef server? Using Ohai extension?

Thank you!

Tetsu

On 2012/02/14, at 2:17, oscar schneider os4839@googlemail.com wrote:

Hi,

you could also save the content of the config file as an attribute value, then store the content to a file on the chef server and set the attributes to nil afterwards.
However committing them to a git or svn server seems to be better suited for the job. For commit rights to a svn server you could use the existing Chef client certificates if you dislike anonymous commits. Not sure if git also provides a ssl certificate based frontend.

Cheers,

Oscar

On Mon, Feb 13, 2012 at 4:54 PM, Brad Knowles bknowles@ihiji.com wrote:
On Feb 13, 2012, at 8:29 AM, tetsu soh wrote:

Is there anyway to get files from each nodes to Chef server?
I need to collect conf files from nodes and then manage them.

Have each node commit updates to their files to a central code repository server, like git & maybe github or your own private git server?

--
Brad Knowles bknowles@ihiji.com
SAGE Level IV, Chef Level 0.0.1

Hey,

yes, doing this via an ohai plugin would probably be easiest, however you
are free to also set it from within a recipe.

Imagine you designate the node[:conffiles] attribute space, then in your
recipe you'd do something like

sshd_conf = File.read("/etc/ssh/sshd_config")

If you only wanna set the attribute the very first time, not on each run:

node.set_unless[:conffiles][:sshd_config] = sshd_conf

or simply

node[:conffiles][:ssh_config] = File.read("/etc/ssh/ssh_config")

Regarding the (in)feasability to install/configure vcs on each node, maybe
a standard webdav server (e.g. apache with mod_dav) would do the job?

Cheers,

Oscar

On Mon, Feb 13, 2012 at 10:41 PM, tetsu.soh@gmail.com wrote:

Hi,

Thank you for your solution.

For committing to central version control system, git or svn client is
required for each node. It may be hard in my case. Another problem is the
burden to the vcs. Number of nodes is huge.

I'm interesting on the approach to save conf as key/value. Could you
detail this? how can I save attribute from nodes to Chef server? Using Ohai
extension?

Thank you!

Tetsu

On 2012/02/14, at 2:17, oscar schneider os4839@googlemail.com wrote:

Hi,

you could also save the content of the config file as an attribute value,
then store the content to a file on the chef server and set the attributes
to nil afterwards.
However committing them to a git or svn server seems to be better suited
for the job. For commit rights to a svn server you could use the existing
Chef client certificates if you dislike anonymous commits. Not sure if git
also provides a ssl certificate based frontend.

Cheers,

Oscar

On Mon, Feb 13, 2012 at 4:54 PM, Brad Knowles bknowles@ihiji.com wrote:

On Feb 13, 2012, at 8:29 AM, tetsu soh wrote:

Is there anyway to get files from each nodes to Chef server?
I need to collect conf files from nodes and then manage them.

Have each node commit updates to their files to a central code repository
server, like git & maybe github or your own private git server?

--
Brad Knowles bknowles@ihiji.com
SAGE Level IV, Chef Level 0.0.1

Hi tetsu,

Here some info about how to write Ohai Plugins:
http://wiki.opscode.com/display/chef/Writing+Ohai+Plugins

And how to distribute them to your nodes:
http://wiki.opscode.com/display/chef/Distributing+Ohai+Plugins

It's quite handy to use them to save data from your nodes and get
later some metrics or to be used by recipes.
I hope this helps.

Cheers :slight_smile:

On Tue, Feb 14, 2012 at 1:53 AM, oscar schneider os4839@googlemail.com wrote:

Hey,

yes, doing this via an ohai plugin would probably be easiest, however you
are free to also set it from within a recipe.

Imagine you designate the node[:conffiles] attribute space, then in your
recipe you'd do something like

sshd_conf = File.read("/etc/ssh/sshd_config")

If you only wanna set the attribute the very first time, not on each run:

node.set_unless[:conffiles][:sshd_config] = sshd_conf

or simply

node[:conffiles][:ssh_config] = File.read("/etc/ssh/ssh_config")

Regarding the (in)feasability to install/configure vcs on each node, maybe a
standard webdav server (e.g. apache with mod_dav) would do the job?

Cheers,

Oscar

On Mon, Feb 13, 2012 at 10:41 PM, tetsu.soh@gmail.com wrote:

Hi,

Thank you for your solution.

For committing to central version control system, git or svn client is
required for each node. It may be hard in my case. Another problem is the
burden to the vcs. Number of nodes is huge.

I'm interesting on the approach to save conf as key/value. Could you
detail this? how can I save attribute from nodes to Chef server? Using Ohai
extension?

Thank you!

Tetsu

On 2012/02/14, at 2:17, oscar schneider os4839@googlemail.com wrote:

Hi,

you could also save the content of the config file as an attribute value,
then store the content to a file on the chef server and set the attributes
to nil afterwards.
However committing them to a git or svn server seems to be better suited
for the job. For commit rights to a svn server you could use the existing
Chef client certificates if you dislike anonymous commits. Not sure if git
also provides a ssl certificate based frontend.

Cheers,

Oscar

On Mon, Feb 13, 2012 at 4:54 PM, Brad Knowles bknowles@ihiji.com wrote:

On Feb 13, 2012, at 8:29 AM, tetsu soh wrote:

Is there anyway to get files from each nodes to Chef server?
I need to collect conf files from nodes and then manage them.

Have each node commit updates to their files to a central code repository
server, like git & maybe github or your own private git server?

--
Brad Knowles bknowles@ihiji.com
SAGE Level IV, Chef Level 0.0.1

--
Juanje

Hi Jesús,

Thank you for the information.

I work it out.

Cheers :slight_smile:

Tetsu

2012/2/14 Juan Jesús Ojeda Croissier juanje.ojeda@gmail.com:

Hi tetsu,

Here some info about how to write Ohai Plugins:
http://wiki.opscode.com/display/chef/Writing+Ohai+Plugins

And how to distribute them to your nodes:
http://wiki.opscode.com/display/chef/Distributing+Ohai+Plugins

It's quite handy to use them to save data from your nodes and get
later some metrics or to be used by recipes.
I hope this helps.

Cheers :slight_smile:

On Tue, Feb 14, 2012 at 1:53 AM, oscar schneider os4839@googlemail.com wrote:

Hey,

yes, doing this via an ohai plugin would probably be easiest, however you
are free to also set it from within a recipe.

Imagine you designate the node[:conffiles] attribute space, then in your
recipe you'd do something like

sshd_conf = File.read("/etc/ssh/sshd_config")

If you only wanna set the attribute the very first time, not on each run:

node.set_unless[:conffiles][:sshd_config] = sshd_conf

or simply

node[:conffiles][:ssh_config] = File.read("/etc/ssh/ssh_config")

Regarding the (in)feasability to install/configure vcs on each node, maybe a
standard webdav server (e.g. apache with mod_dav) would do the job?

Cheers,

Oscar

On Mon, Feb 13, 2012 at 10:41 PM, tetsu.soh@gmail.com wrote:

Hi,

Thank you for your solution.

For committing to central version control system, git or svn client is
required for each node. It may be hard in my case. Another problem is the
burden to the vcs. Number of nodes is huge.

I'm interesting on the approach to save conf as key/value. Could you
detail this? how can I save attribute from nodes to Chef server? Using Ohai
extension?

Thank you!

Tetsu

On 2012/02/14, at 2:17, oscar schneider os4839@googlemail.com wrote:

Hi,

you could also save the content of the config file as an attribute value,
then store the content to a file on the chef server and set the attributes
to nil afterwards.
However committing them to a git or svn server seems to be better suited
for the job. For commit rights to a svn server you could use the existing
Chef client certificates if you dislike anonymous commits. Not sure if git
also provides a ssl certificate based frontend.

Cheers,

Oscar

On Mon, Feb 13, 2012 at 4:54 PM, Brad Knowles bknowles@ihiji.com wrote:

On Feb 13, 2012, at 8:29 AM, tetsu soh wrote:

Is there anyway to get files from each nodes to Chef server?
I need to collect conf files from nodes and then manage them.

Have each node commit updates to their files to a central code repository
server, like git & maybe github or your own private git server?

--
Brad Knowles bknowles@ihiji.com
SAGE Level IV, Chef Level 0.0.1

--
Juanje

Hi Oscar,

Your answer is really helpful.

I followed your instruction and it works!

Thank you!

Tetsu

On Tue, Feb 14, 2012 at 10:53 AM, oscar schneider os4839@googlemail.com wrote:

Hey,

yes, doing this via an ohai plugin would probably be easiest, however you
are free to also set it from within a recipe.

Imagine you designate the node[:conffiles] attribute space, then in your
recipe you'd do something like

sshd_conf = File.read("/etc/ssh/sshd_config")

If you only wanna set the attribute the very first time, not on each run:

node.set_unless[:conffiles][:sshd_config] = sshd_conf

or simply

node[:conffiles][:ssh_config] = File.read("/etc/ssh/ssh_config")

Regarding the (in)feasability to install/configure vcs on each node, maybe a
standard webdav server (e.g. apache with mod_dav) would do the job?

Cheers,

Oscar

On Mon, Feb 13, 2012 at 10:41 PM, tetsu.soh@gmail.com wrote:

Hi,

Thank you for your solution.

For committing to central version control system, git or svn client is
required for each node. It may be hard in my case. Another problem is the
burden to the vcs. Number of nodes is huge.

I'm interesting on the approach to save conf as key/value. Could you
detail this? how can I save attribute from nodes to Chef server? Using Ohai
extension?

Thank you!

Tetsu

On 2012/02/14, at 2:17, oscar schneider os4839@googlemail.com wrote:

Hi,

you could also save the content of the config file as an attribute value,
then store the content to a file on the chef server and set the attributes
to nil afterwards.
However committing them to a git or svn server seems to be better suited
for the job. For commit rights to a svn server you could use the existing
Chef client certificates if you dislike anonymous commits. Not sure if git
also provides a ssl certificate based frontend.

Cheers,

Oscar

On Mon, Feb 13, 2012 at 4:54 PM, Brad Knowles bknowles@ihiji.com wrote:

On Feb 13, 2012, at 8:29 AM, tetsu soh wrote:

Is there anyway to get files from each nodes to Chef server?
I need to collect conf files from nodes and then manage them.

Have each node commit updates to their files to a central code repository
server, like git & maybe github or your own private git server?

--
Brad Knowles bknowles@ihiji.com
SAGE Level IV, Chef Level 0.0.1