jeff1evesque / iScanner

Backend iOS, and Android logic for facial, and iris recognition
1 stars 0 forks source link

Install, and setup Puppet within Vagrant #8

Open jeff1evesque opened 9 years ago

jeff1evesque commented 9 years ago

After #4 has been resolved, we will implement puppet in order to manage various configurations.

Note: this issue corresponds to https://github.com/jeff1evesque/machine-learning/issues/1351

jeff1evesque commented 9 years ago

There are three ways we can install puppet within Vagrant:

The latter is essentially a bash script that vagrant runs during installation (vagrant up process). Therefore, the ordinary apt-get command to install puppet, can be placed within the bash script.

Note: the path to the provisioning script must be relative to the directory where the vagrantfile is located, or inline within the vagrantfile:

$script = <<SCRIPT
echo I am provisioning...
date > /etc/vagrant_provisioned_at
SCRIPT

Vagrant.configure("2") do |config|
  config.vm.provision "shell", inline: $script
end

Note: the SCRIPT keyword is not reserved, and follows the heredoc syntax. This means, SCRIPT could be any arbitrary word. Essentially, it says anything between <<SCRIPT, and SCRIPT, should be considered text.

The following is also acceptable for inline shell provisioning:

Vagrant::Config.run do |config|
  config.vm.provision :shell, :inline => "echo foo > /vagrant/test"
end

Also, if multiple scripts is needed, then multiple lines of the following must be placed within the vagrantfile:

 config.vm.provision :shell, path: 'myscript.sh'

Note: replace myscript.sh as needed.

jeff1evesque commented 9 years ago

Puppet can be run in two cases:

The following installs both the puppetmaster, and the puppet client:

sudo apt-get install puppetmaster
sudo apt-get install puppet

Note: vagrant supports either choices.

jeff1evesque commented 9 years ago

Implementing a puppet master, with puppet client requires the following installation:

Then, we need to make puppet configurations:

Lastly, the Vagrantfile needs configuration of its own including:

The puppet.puppet_server defines the name of the puppet master Vagrantfile:

Vagrant::Config.run do |config|
  config.vm.provision :puppet_server do |puppet|
    puppet.puppet_server = "puppet.example.com"
    puppet.puppet_node = "vm.example.com"
  end
end

Also, the name that the client node (agent) registers as, can be customized. Puppet uses this node name to identify both the configuration to be applied and to generate an SSL certificate to authenticate the node to the Puppet Server. The node name defaults to the name of the box being provisioned.

Note: we override the pupper server name (from puppet) to puppet.example.com.