Ask Your Question
0

moving file from agent to agent.

asked 2015-03-16 19:12:02 -0600

jimsonpai gravatar image

updated 2015-03-16 19:14:38 -0600

Puppets: agent1 and agent2. agent have have /etc/Afile how to use puppet master to move agent1's /etc/Afile to agent2's /etc/?

note: it has to be cp/scp-like action. Copy the content of the file and pasting it in agent2's directory is not ideal.

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-03-19 06:30:33 -0600

rnelson0 gravatar image

I would assume that Afile is managed by puppet (if it is not, it should be, it sounds like part of the state of your node!). Use the same mechanism you use to distribute or control the contents of that file on agent1 on agent2. For instance, the same File resource can be applied to both nodes, or a class/defined type that includes the File resource.

class Afile {
  file {'/etc/Afile':
    ensure  => file,
    content => 'this is file A',
  }
}

node agent1 { include Afile }
node agent2 { include Afile }

You may still believe you want to copy the file between agents using scp. You really do not want to take the file from agent1 and copy it to agent2. That's not good configuration management. What if someone deletes the file on agent1 or alters it in such a way that it breaks the application or introduces a backdoor? It is much more secure to use Puppet to enforce the contents of the file in both locations, as the master is more trusted. Your Puppet code should be in version control and if someone does introduce malformed contents or a backdoor, you will have logs to help you identify the culprit and restore a good state.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2015-03-16 19:12:02 -0600

Seen: 173 times

Last updated: Mar 19 '15