Skip to content

Instantly share code, notes, and snippets.

@ErikAndreas
Created May 7, 2014 10:32
Show Gist options
  • Save ErikAndreas/e4f413d1811886539355 to your computer and use it in GitHub Desktop.
Save ErikAndreas/e4f413d1811886539355 to your computer and use it in GitHub Desktop.
Vagrant puppet nginx node.js nodemon on Ubuntu 14.04
group { 'puppet': ensure => 'present' }
File { ignore => '.svn' }
exec { 'apt-get update':
command => '/usr/bin/apt-get update'
}
package { 'python-software-properties':
ensure => present,
require => Exec['apt-get update']
}
exec { 'add_nginx_repo':
command => 'add-apt-repository ppa:nginx/development --yes && apt-get update',
path => '/usr/bin',
require => Package['python-software-properties']
}
exec { 'add_node_repo':
command => 'add-apt-repository ppa:chris-lea/node.js --yes && apt-get update',
path => '/usr/bin',
require => Package['python-software-properties']
}
exec { "install_nginx":
command => "/usr/bin/apt-get install nginx -y --force-yes",
path => "/usr/bin:/usr/local/bin:/bin:/usr/sbin:/sbin",
unless => "ls /usr/sbin/nginx ",
require => Exec["add_nginx_repo"]
}
exec { "install_node":
command => "/usr/bin/apt-get install nodejs -y --force-yes",
path => "/usr/bin:/usr/local/bin:/bin:/usr/sbin:/sbin",
require => Exec["add_node_repo"]
}
service { 'nginx':
ensure => running,
require => Exec['install_nginx'],
}
file { '/etc/nginx':
require => Exec['install_nginx'],
ensure => 'directory',
source => '/vagrant/vagrant/nginx',
recurse => true,
notify => Service['nginx']
}
exec { "fix_npm":
command => "npm config set prefix /home/vagrant/npm",
path => "/usr/bin:/usr/local/bin:/bin:/usr/sbin:/sbin",
require => Exec["install_node"]
}
file { "/etc/profile.d/setnpmpath.sh" :
content => "export PATH=\$HOME/npm/bin:\$PATH",
require => Exec["fix_npm"]
}
exec { "install_nodemon" :
command => "npm install nodemon -g",
path => "/usr/bin:/usr/local/bin:/bin:/usr/sbin:/sbin",
require => File["/etc/profile.d/setnpmpath.sh"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment