Automate composer self-updating using Puppet

I have a built-in PHP compiler all over the world, and I'm trying to get Puppet to automatically run the composer self-update command.

Here is my manifest:

exec { "composer self-update": path => '/usr/local/bin/' } 

Doing "/ usr / local / bin / composer self-update" since root manually works, but when the puppets start, it generates this error:

change from notrun to 0: / usr / bin / env: php: No such file or directory

I don’t understand why leadership behavior is different from Puppet behavior.

In addition, I have Puppet with root privileges.

+4
source share
2 answers

Running what you wrote should work. However, you can use the command parameter:

 exec { "do_some_update" : command => "composer self-update", path => "/usr/local/bin", } 

So you can refer to exec later if you want:

  file { "configuration" : require => Exec["do_some_update"] } 

instead of typing Exec["/usr/local/bin/composer self-update"]

+1
source

I was able to solve this myself by changing exec. I'm not sure why there is a difference, but this works:

 exec { "/usr/local/bin/composer self-update":} 

Note that the difference is that the path is specified in the exec name instead of the path parameter. If anyone knows why this did not work differently, this may be informative.

+1
source

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


All Articles