Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##Vagrantfile
- Vagrant.configure("2") do |config|
- config.vm.box = "precise64"
- config.vm.box_url = "http://files.vagrantup.com/precise64.box"
- config.ssh.forward_x11 = true
- config.vm.provision :puppet,
- :options => "--modulepath=/vagrant/modules" do |puppet|
- puppet.manifests_path = "."
- puppet.manifest_file = "site.pp"
- end
- config.vm.define :python3 do |python3|
- python3.vm.hostname = "python3"
- python3.vm.provider :virtualbox do |virtualbox|
- virtualbox.name = "python3"
- end
- python3.vm.network :forwarded_port, guest: 8888, host: 8888
- end
- end
- ###site.pp
- node default {
- include testVM
- }
- #in modules/testVM//manifests/box/python3.pp
- class testVM::box::python3 {
- #I was hoping this require statement would install python3 & virtualenv first?
- require python3::base
- #But it doesn't seem to because the following exec runs first and fails?
- #ssh'ing into the VM and the base packages didn't install?
- exec {
- 'py3-venv':
- command => '/usr/bin/virtualenv --python=/usr/bin/python3 testpy3',
- require => Package['openssh-server','python-virtualenv'];
- ##I think problem is narrowed down to this - how do I run source or . ?
- 'py3-activate':
- command => 'source testpy3/bin/activate',
- require=>Exec['py3-venv'];
- }
- #Try to add in a dependency to force package install - still doesn't work?
- Package['python3']->Exec['py3-venv']
- #Install in a small package to check it appears in python3 env
- package {
- [
- 'ipythonblocks'
- ]: ensure => latest,
- provider => 'pip';
- }
- }
- #I assumed this would install before the exec fired but it doesn't seem to?
- class testVM::box::python3::base {
- package { 'python3':
- ensure => latest
- }
- package {
- [ 'ipython3',
- 'python-virtualenv'
- ]: require => Package['python3'];
- }
- }
- script
- export HOME="/root"
- /vagrant/notebooks/ipython3 notebook --ip 0.0.0.0
- end script
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement