I am using Vagrant and Puppet to install Apache and PHP on Ubuntu. However I am getting the error below during vagrant up
. I think the path for the templates are correct, then why the error?
I'm using the setup here modified to ensure apt-get update
runs before anything else
Error
←[1;35merr: /Stage[main]/Php/File[/etc/php5/apache2/apc.ini]/ensure: change from
absent to present failed: Could not set 'present on ensure: No such file or dir
ectory - /etc/php5/apache2/apc.ini.puppettmp_6187 at /tmp/vagrant-puppet/modules
-0/php/manifests/init.pp:44←[0m
←[1;35merr: /Stage[main]/Php/File[/etc/php5/apache2/php.ini]/ensure: change from
absent to present failed: Could not set 'present on ensure: No such file or dir
ectory - /etc/php5/apache2/php.ini.puppettmp_6687 at /tmp/vagrant-puppet/modules
-0/php/manifests/init.pp:36←[0m
/modules/php/manifests/init.pp
file { "/etc/php5/apache2/php.ini":
ensure => present,
mode => 644,
content => template("php/etc/php5/conf.d/php.ini.erb"),
require => Package["php5"],
notify => Service["apache"];
}
file { "/etc/php5/apache2/apc.ini":
ensure => present,
mode => 644,
content => template("php/etc/php5/conf.d/apc.ini.erb"),
require => [ Package["php5"], Package["php-apc"], Package["apache"] ],
notify => Service["apache"];
}
Templates
Just ensure that directory /etc/php5/apache2 exists.
file { [ "/etc", "/etc/php5", "/etc/php5/apache2" ]:
ensure => directory,
before => File['/etc/php5/apache2/php.ini'],
}
or little less Puppet-ish
exec { "ensure /etc/php5/apache2":
command => "mkdir -p /etc/php5/apache2",
creates => "/etc/php5/apache2"
}
All this is probably because of assumptions on the order of execution.
More info @ the puppet docs
Are you sure Package["php5"] it's creating the path for you?
It seems to me that it's complaining because /etc/php5/apache2 folder does not exist when it tries to create the files from the templates.
If you want to discard your puppetmaster side you can find puppetmaster process id and run:
strace -v -f -ff -p $PID -o strace.log
Then, run the agent again and go to puppetmaster and run:
grep "etc/php5/apache2" strace.log.*
If puppetmaster it's ok you will see the reading call without errors, else you will see that puppetmaster receives "no such file or directory" when trying to open the file. Anyway as you I don't think the problem it's with template call, seems ok to me,.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With