dev/Puppet_Readme.md
author cavaliet
Thu, 13 Nov 2014 16:27:11 +0100
changeset 157 a3b764f393a0
parent 136 66972b143124
permissions -rw-r--r--
Added tag V00.06.06 for changeset 60917da03414
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
136
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
     1
# Puppet provisioning ReadMe
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
     2
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
     3
This document will describe how to set up a Puppet-provisioned Vagrant VM ready for development, as well as the inner working of the provisioning.
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
     4
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
     5
## How to use:
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
     6
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
     7
### Requirements:
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
     8
- Oracle VirtualBox 4.3.12
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
     9
- Vagrant 1.6.5
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    10
- Mercurial (to get the source code of the project)
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    11
- Git (to clone the required subrepositories if necessary)
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    12
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    13
NOTE: Make sure your git and mercurial pulls are set to clone the file "as-is", especially if you're on Windows, due to all kind of line ending problems that can occur if you don't.
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    14
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    15
### Installing
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    16
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    17
Once you have installed VirtualBox and Vagrant on your machine, pull the mercurial repository in a directory of your choice (we'll refer to it as /root/ from now on). Check if you have the following directories in /root/dev/modules:
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    18
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    19
- apt
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    20
- concat
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    21
- elasticsearch
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    22
- postgresql
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    23
- stdlib
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    24
- sysconfig
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    25
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    26
If you miss all the modules save sysconfig, this means the subrepositories didn't import properly. To remedy this, look up the /root/.hgsub files and use git clone commands to manually import the missing modules in their respective directories.
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    27
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    28
You can customize the installation (modifying database names and informations, or virtualenv location for instance) by creating a custom.yaml file from the custom.yaml.tmpl file in the /root/dev/ directory and uncommenting values you want to override. This is by no means necessary and puppet will manage to set up your machine using default values if you don't.
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    29
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    30
Once all the files are here and your options are properly configured, you just have to run the following command from /root/dev:
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    31
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    32
    vagrant up
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    33
    
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    34
Once the vagrant up command is done setting up the machine, run this command
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    35
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    36
    vagrant reload
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    37
    
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    38
So it fixes a bug with shared folders (see below).
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    39
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    40
This will set up the virtualbox and provision it via puppet. From there, you can ssh into your machine, activate your virtualenv from the directory you specified in the config file (default is /home/vagrant/myspelenv/).
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    41
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    42
Your /root/ directory will be located on the virtual machine in the /srv/ directory.
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    43
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    44
You can then run the following command (from the /srv/root/src directory) for testing purpose:
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    45
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    46
    python manage.py runserver 0.0.0.0:8000
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    47
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    48
You'll have to open a browser page to 127.0.0.1:8001 to see your test site.
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    49
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    50
###Notes and known bugs
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    51
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    52
Windows users can experience a bug with shared folder (shared folders would only work the first time you setup the vm) due to the way Windows (doesn't) handle symlinks. Here are the steps to fix it manually:
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    53
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    54
* ssh into the machine
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    55
* run the following command:
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    56
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    57
        sudo /etc/init.d/vboxadd setup
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    58
    
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    59
* then from the host machine vagrantfile directory, run
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    60
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    61
        vagrant reload
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    62
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    63
The machine should then set up correctly when you use 'vagrant up'
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    64
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    65
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    66
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    67
#How it works
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    68
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    69
## Some little things about Puppet
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    70
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    71
Puppet syntax is declarative. This means that for Puppet to automatically set up your VM, you basically just have to tell Puppet the resources you need installed on your VM, the commands it must run when required, as well as the order in which Puppet should do all this.
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    72
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    73
Puppet will need 2 things to run properly:
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    74
* a .pp manifest file and the path to it, ours is site.pp, which we put in the root/dev/manifests directory. This manifest is the backbone of the puppet script and the one we use to arrange all our provisioning so Puppet installs everything in the right order.
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    75
* a path to find required modules, which we put in the /root/dev/modules directory.
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    76
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    77
These informations must be provided to Vagrant so it knows that we will set up our VM with puppet. If you open the VagrantFile, you will see these lines around the end of the file:
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    78
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    79
    config.vm.provision :puppet do |puppet|
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    80
        puppet.manifests_path = "manifests"
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    81
        puppet.manifest_file  = "site.pp"
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    82
        puppet.module_path    = "modules"
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    83
        puppet.options        = "--hiera_config /vagrant/hiera.yaml"
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    84
        puppet.facter = {
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    85
          "vagrant_base_path" => File.dirname(__FILE__)
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    86
    }
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    87
    end
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    88
    
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    89
This bit of code tells Vagrant to use Puppet to provision the machine, and specify the different informations we talked about just above. The last one we need to describe is the puppet.option line, which tells puppet to check the hiera.yaml file. This file is used to tell puppet where to find the files containing the definitions of the global configuration variables: basically it tells puppet to check our config.yaml file and from there set the appropriate global variables.
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    90
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    91
## A look at site.pp
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    92
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    93
Here is our site.pp file:
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    94
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    95
    exec {
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    96
    'apt_update_site':
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    97
      command     => '/usr/bin/apt-get update',
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    98
      timeout     => 2400,
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
    99
      returns     => [ 0, 100 ];
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   100
      #refreshonly => true;
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   101
    
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   102
    }
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   103
    
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   104
    Exec["apt_update_site"] -> Package <| |>
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   105
    
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   106
    # upgrade system
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   107
    class { 'sysconfig::sys_upgrade': }->
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   108
    
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   109
    # params
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   110
    class { 'sysconfig::params': }->
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   111
    
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   112
    # install packages
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   113
    class { 'sysconfig::packages': }->
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   114
    
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   115
    # install postgres
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   116
    class { 'sysconfig::postgresql': }->
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   117
    
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   118
    # set up the virtualenv
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   119
    class { 'sysconfig::virtualenv': }->
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   120
    
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   121
    # write config
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   122
    class { 'sysconfig::config': }->
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   123
    
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   124
    # write django_init
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   125
    class { 'sysconfig::django_init': }->
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   126
    
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   127
    exec { 'shared_folder_fix_OracleVM_4.3.12':
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   128
       command  => 'sudo /etc/init.d/vboxadd setup'
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   129
    }
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   130
    
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   131
The first exec block runs the apt-get update command. Just below this we have the Exec["apt_update_site"] -> Package <| |> which is meant to tell Puppet "do the "apt_update_site" command before installing any package resource". 
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   132
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   133
Then we have a number of class declarations, which are all subclasses of the "sysconfig" class from the "sysconfig" submodule, which is the custom module for puppet provisioning we are building. Each class has a corresponding .pp file with the relevant instructions in, located in /root/dev/modules/sysconfig/manifests/. This way we can properly identify what each file do and most importantly when. You will notice the -> at the end of class declarations, this is used to tell Puppet in which order it must process the different classes we have declared.
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   134
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   135
At the end of the file is an exec command that will be executed last, meant to fix the shared folders problems we can encounter on Windows.
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   136
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   137
### The Sysconfig submodule
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   138
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   139
The Sysconfig submodule is our main module. All the .pp manifests can be found in the /root/dev/modules/sysconfig/manifest folder. A notable one is init.pp which is a mandatory manifest in any Puppet submodule containing the sysconfig class definition. All the other manifests are the subclasses of the sysconfig class that are called in site.pp.
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   140
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   141
* sys_upgrade class
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   142
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   143
This class executes commands such as apt-get upgrade and apt-get dist upgrade, as well as adding the apt postgresql repository and key to the sources.list.d folder so the postgresql module will get it from there when installing postgresql.
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   144
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   145
* params class
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   146
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   147
This class has a number of hiera(var_name, default_value) calls, which Puppet uses to set a the variable named var_name to the corresponding value from the config file mentioned in the hiera.yaml file. If there is no config.yaml file or it can't find your config.yaml file (it can be because you didn't make one), it will set the variable to default_value. 
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   148
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   149
This is the class where you can find all the default values for the variables used in the puppet provisioning.
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   150
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   151
* packages class
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   152
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   153
A straightforward class that will install all the required packages for your provisioning that you would normally install via apt-get install command if you didn't use puppet. It use the puppet Package resource for this. The package list is not generated so if you need a new package at some point, you'll have to add it here for it to be installed automatically on new VMs.
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   154
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   155
* postgres class
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   156
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   157
This class will install and setup Postgresql according to the parameters specified in config.yaml. 
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   158
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   159
* virtualenv class
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   160
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   161
This class will set up the virtual env in the directory mentioned in config.yaml and install all python packages into it, using the create_python_env.py script and the resulting project-boot.py script.
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   162
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   163
* config class
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   164
 
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   165
The config class generates the config.py file using a template you can find in /root/dev/modules/sysconfig/template. To do this we use the File resource of Puppet with the attribute "ensure => 'present' " and "content => template(templatepath)"
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   166
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   167
* django_init class
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   168
 
66972b143124 Fixes to puppet provisioning, Puppet_Readme.md added, custom.yaml removed from tracking (error)
Nicolas DURAND <nicolas.durand@iri.centrepompidou.fr>
parents:
diff changeset
   169
Finally, this class initialize Django, by doing the syncb and superuser creation. Additionally for spel, it does the manip with south commenting for migrations by calling a Python script (stored in root/dev/files) that parse the file and replace "'south'," by "#'south'," and vice-versa.