| 1 | [[PageOutline]] |
| 2 | = freepuppet-helper = |
| 3 | |
| 4 | freepuppet-helper is a python script for executing commands either locally or on a series of remote hosts. |
| 5 | |
| 6 | Our [wiki:puppet puppet repo] contains a helper directory with freepuppet-helper.py and freepuppet-helper. |
| 7 | |
| 8 | == Why do we need a python script if we have puppet? == |
| 9 | |
| 10 | 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). |
| 11 | |
| 12 | 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. |
| 13 | |
| 14 | == How do I install it? == |
| 15 | |
| 16 | It's already there with the git repo. For convenience, you should take a couple extra steps: |
| 17 | |
| 18 | * Add a symlink to your freepuppet-helper in your ~/bin directory (or another directory in your $PATH) |
| 19 | * Add this line to your ~/.bashrc file, changing the path to the appropriate value: |
| 20 | {{{ |
| 21 | export FREEPUPPET_REPO_PATH=/home/jamie/projects/mfpl/puppet/confdir |
| 22 | }}} |
| 23 | |
| 24 | == How do I use it? == |
| 25 | |
| 26 | Run freepuppet-helper followed by one or more sub-commands. |
| 27 | |
| 28 | For example: |
| 29 | |
| 30 | {{{ |
| 31 | freepuppet-helper ls |
| 32 | }}} |
| 33 | |
| 34 | Will generate a list of servers located in our manifests/nodes/production directory. |
| 35 | |
| 36 | You can limit the list by adding a colon separted argument to the command, by either specifying a specific server: |
| 37 | |
| 38 | {{{ |
| 39 | 0 jamie@chicken:~$ freepuppet-helper ls:mandela |
| 40 | mandela |
| 41 | 0 jamie@chicken:~$ |
| 42 | }}} |
| 43 | |
| 44 | Or, by specifying a phrase to grep all server manifests for: |
| 45 | |
| 46 | {{{ |
| 47 | 0 jamie@chicken:~$ freepuppet-helper ls:mosh |
| 48 | albizu |
| 49 | chavez |
| 50 | daza |
| 51 | debs |
| 52 | didier |
| 53 | dorothy |
| 54 | eagle |
| 55 | ella |
| 56 | galeano |
| 57 | jones |
| 58 | julia |
| 59 | june |
| 60 | lucius |
| 61 | lucy |
| 62 | lumumba |
| 63 | malcolm |
| 64 | mandela |
| 65 | menchu |
| 66 | proudhon |
| 67 | rodolpho |
| 68 | roe |
| 69 | sojourner |
| 70 | viewsic |
| 71 | 0 jamie@chicken:~$ |
| 72 | }}} |
| 73 | |
| 74 | ls is a local command, meaning it is executed on your computer. |
| 75 | |
| 76 | |
| 77 | == What other commands are available? == |
| 78 | |
| 79 | Run: |
| 80 | |
| 81 | {{{ |
| 82 | fab -l |
| 83 | }}} |
| 84 | |
| 85 | To see a list of all available commands (and their aliases) |
| 86 | |
| 87 | == How can I add new commands? == |
| 88 | |
| 89 | Simply edit the freepuppet-helper.py script and commit and push your changes. |