| 1 |
Vagrant/Puppet |
| 2 |
======= |
| 3 |
|
| 4 |
This example uses Puppet to install PyEz with PIP using either PyPi or Git. |
| 5 |
|
| 6 |
---------- |
| 7 |
|
| 8 |
|
| 9 |
Prerequisites |
| 10 |
--------- |
| 11 |
|
| 12 |
|
| 13 |
- **[vagrant](http://www.vagrantup.com) 1.5** |
| 14 |
- **[virtualbox](http://www.virtualbox.org) 4.3** |
| 15 |
- rsync on host |
| 16 |
|
| 17 |
|
| 18 |
Once Vagrant brings up the guest OS, two provisioners are executed in the following order: |
| 19 |
|
| 20 |
1. Shell |
| 21 |
1. Install Puppet |
| 22 |
2. Execute Puppet manifest |
| 23 |
1. Install dependencies with system package manager |
| 24 |
2. Install PyEZ with pip |
| 25 |
|
| 26 |
|
| 27 |
For the script provisioner to install Puppet the required shell script must be present (as defined in the Vagrantfile). |
| 28 |
|
| 29 |
These are provided at https://github.com/hashicorp/puppet-bootstrap/ |
| 30 |
|
| 31 |
Some editing of the files is necessary. |
| 32 |
|
| 33 |
For example, centos_6_x.sh can be changed to fedora-20.sh with the following update: |
| 34 |
``` |
| 35 |
REPO_URL="https://yum.puppetlabs.com/fedora/f20/products/x86_64/puppetlabs-release-20-10.noarch.rpm" |
| 36 |
``` |
| 37 |
|
| 38 |
|
| 39 |
In testing the Debian script had to be modified. A diff is provided below. |
| 40 |
|
| 41 |
debian.sh |
| 42 |
``` |
| 43 |
5a6,10 |
| 44 |
> if [ "$(id -u)" != "0" ]; then |
| 45 |
> echo "This script must be run as root." >&2 |
| 46 |
> exit 1 |
| 47 |
> fi |
| 48 |
> |
| 49 |
22,25d26 |
| 50 |
< if [ "$EUID" -ne "0" ]; then |
| 51 |
< echo "This script must be run as root." >&2 |
| 52 |
< exit 1 |
| 53 |
< fi |
| 54 |
``` |
| 55 |
|
| 56 |
Guest Operating Systems |
| 57 |
--------------- |
| 58 |
- Ubuntu 12.04 |
| 59 |
- Ubuntu 12.10 |
| 60 |
- Ubuntu 13.10 |
| 61 |
- Fedora 19 |
| 62 |
- Fedora 20 |
| 63 |
- CentOS 6.5 |
| 64 |
- Debian 7.4 |
| 65 |
- FreeBSD 9.2 |
| 66 |
|
| 67 |
|
| 68 |
Usage |
| 69 |
--------------- |
| 70 |
The Puppet module is initialized from manifests/default.pp. |
| 71 |
|
| 72 |
PyEZ can be installed either via PyPi or Git. |
| 73 |
|
| 74 |
PyPi |
| 75 |
``` |
| 76 |
class{'pyez': |
| 77 |
mode => 'pypi', |
| 78 |
version => 'present', # Can be any version published to PyPi |
| 79 |
} |
| 80 |
``` |
| 81 |
|
| 82 |
Git |
| 83 |
``` |
| 84 |
class{'pyez': |
| 85 |
mode => 'git', |
| 86 |
version => 'present', # present for HEAD or any commit, tag, or branch. |
| 87 |
} |
| 88 |
``` |