Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. ##Vagrantfile
  2.  
  3. Vagrant.configure("2") do |config|
  4.  
  5. config.vm.box = "precise64"
  6. config.vm.box_url = "http://files.vagrantup.com/precise64.box"
  7.  
  8. config.ssh.forward_x11 = true
  9.  
  10. config.vm.provision :puppet,
  11. :options => "--modulepath=/vagrant/modules" do |puppet|
  12. puppet.manifests_path = "."
  13. puppet.manifest_file = "site.pp"
  14. end
  15.  
  16. config.vm.define :python3 do |python3|
  17. python3.vm.hostname = "python3"
  18. python3.vm.provider :virtualbox do |virtualbox|
  19. virtualbox.name = "python3"
  20. end
  21. python3.vm.network :forwarded_port, guest: 8888, host: 8888
  22. end
  23. end
  24.  
  25. ###site.pp
  26. node default {
  27. include testVM
  28. }
  29.  
  30.  
  31. #in modules/testVM//manifests/box/python3.pp
  32. class testVM::box::python3 {
  33. #I was hoping this require statement would install python3 & virtualenv first?
  34. require python3::base
  35.  
  36. #But it doesn't seem to because the following exec runs first and fails?
  37. #ssh'ing into the VM and the base packages didn't install?
  38. exec {
  39. 'py3-venv':
  40. command => '/usr/bin/virtualenv --python=/usr/bin/python3 testpy3',
  41. require => Package['openssh-server','python-virtualenv'];
  42. ##I think problem is narrowed down to this - how do I run source or . ?
  43. 'py3-activate':
  44. command => 'source testpy3/bin/activate',
  45. require=>Exec['py3-venv'];
  46. }
  47.  
  48. #Try to add in a dependency to force package install - still doesn't work?
  49. Package['python3']->Exec['py3-venv']
  50.  
  51. #Install in a small package to check it appears in python3 env
  52. package {
  53. [
  54. 'ipythonblocks'
  55. ]: ensure => latest,
  56. provider => 'pip';
  57. }
  58. }
  59.  
  60. #I assumed this would install before the exec fired but it doesn't seem to?
  61. class testVM::box::python3::base {
  62. package { 'python3':
  63. ensure => latest
  64. }
  65. package {
  66. [ 'ipython3',
  67. 'python-virtualenv'
  68. ]: require => Package['python3'];
  69. }
  70. }
  71.  
  72. script
  73. export HOME="/root"
  74. /vagrant/notebooks/ipython3 notebook --ip 0.0.0.0
  75. end script
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement