Vagrant / Puppet --- provide: change the current one: failed to install "present on make": there is no such file or directory

I use Vagrant and Puppet to install Apache and PHP on Ubuntu. However, during vagrant up I get the error message below. I think the path to the templates is correct, then why the error?

I use the setting here , modified to ensure that apt-get update is executed first

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"]; } 

Patterns

  • /modules/php/templates/etc/php5/conf.d/apc.ini.erb
  • /modules/php/templates/etc/php5/conf.d/php.ini.erb
+4
source share
2 answers

Are you sure the package ["php5"] created the path for you?

It seems to me that he is complaining because the / etc / php 5 / apache2 folder does not exist when he tries to create files from templates.

If you want to drop your puppeteer side, you can find the doll process id and run:

 strace -v -f -ff -p $PID -o strace.log 

Then start the agent again and go to puppetmaster and run:

 grep "etc/php5/apache2" strace.log.* 

If the puppet is normal, you will see a read call without errors, otherwise you will see that the puppeteer receives "there is no such file or directory" when you try to open the file. Anyway, like you, I don’t think that the problem with calling the template, I don’t care

+1
source

Just make sure the / etc / php 5 / apache2 directory exists.

 file { [ "/etc", "/etc/php5", "/etc/php5/apache2" ]: ensure => directory, before => File['/etc/php5/apache2/php.ini'], } 

or slightly less puppet-ish

 exec { "ensure /etc/php5/apache2": command => "mkdir -p /etc/php5/apache2", creates => "/etc/php5/apache2" } 

All this is probably due to assumptions about the execution order.

Read more @ puppet documents

+11
source

Source: https://habr.com/ru/post/1438413/


All Articles