Version 1 (modified by 14 years ago) ( diff ) | ,
---|
freepuppet-helper
freepuppet-helper is a python script for executing commands either locally or on a series of remote hosts.
Our puppet repo contains a helper directory with freepuppet-helper.py and freepuppet-helper.
Why do we need a python script if we have puppet?
Puppet allows us to easily ensure that a set of commands and files are executed and copied to our servers (and will execute/copy the commands/files over and over again if necessary).
The freepuppet-helper script allows us to execute/copy a command/file to one or more servers once and witness the output. Also, it allows us to perform operations locally, like list available servers or automate setting up a git remote for each server's puppet repository.
How do I install it?
It's already there with the git repo. For convenience, you should take a couple extra steps:
- Add a symlink to your freepuppet-helper in your ~/bin directory (or another directory in your $PATH)
- Add this line to your ~/.bashrc file, changing the path to the appropriate value:
export FREEPUPPET_REPO_PATH=/home/jamie/projects/mfpl/puppet/confdir
How do I use it?
Run freepuppet-helper followed by one or more sub-commands.
For example:
freepuppet-helper ls
Will generate a list of servers located in our manifests/nodes/production directory.
You can limit the list by adding a colon separted argument to the command, by either specifying a specific server:
0 jamie@chicken:~$ freepuppet-helper ls:mandela mandela 0 jamie@chicken:~$
Or, by specifying a phrase to grep all server manifests for:
0 jamie@chicken:~$ freepuppet-helper ls:mosh albizu chavez daza debs didier dorothy eagle ella galeano jones julia june lucius lucy lumumba malcolm mandela menchu proudhon rodolpho roe sojourner viewsic 0 jamie@chicken:~$
ls is a local command, meaning it is executed on your computer.
What other commands are available?
Run:
fab -l
To see a list of all available commands (and their aliases)
How can I add new commands?
Simply edit the freepuppet-helper.py script and commit and push your changes.