Skip to content

Instantly share code, notes, and snippets.

@dragonmantank
Last active January 21, 2016 17:39
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dragonmantank/6723460 to your computer and use it in GitHub Desktop.
Save dragonmantank/6723460 to your computer and use it in GitHub Desktop.
Reset Apache httpd to run as the vagrant user
exec { "change_httpd_user":
command => "sed -i 's/www-data/vagrant/g' /etc/apache2/envvars",
onlyif => "/bin/grep -q 'www-data' '/etc/apache2/envvars'",
notify => Service['apache2'],
require => Package['apache2'],
}
file { "/var/lock/apache2":
ensure => "directory",
owner => "vagrant",
group => "vagrant",
require => Exec['change_httpd_user'],
}
@jeremykendall
Copy link

@dragonmantank: I'm dropped this in my manifests/default.pp but I'm not getting any joy so far. Any gotchas I need to look out for?

@jeremykendall
Copy link

@dragonmantank: I had to tweak yours a bit before I got it working, but it works like a charm. Thanks again!

@jeremykendall
Copy link

Win. Thanks!

@rdohms
Copy link

rdohms commented Dec 12, 2013

problem i get when apache restart is issued is: * There are processes named 'apache2' running which do not match your pid file which are left untouched in the name of safety, Please review the situation by hand.

ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment