class php::composer( $provider = 'upstream', ) { package { 'composer': ensure => $provider ? { 'package' => present, default => absent, }, } file { '/usr/local/bin/getcomposer': ensure => present, owner => root, group => root, mode => '0755', source => 'puppet:///modules/php/getcomposer', } if ($provider == 'package') { file { '/usr/local/bin/composer': ensure => absent, } } if ($provider == 'upstream') { exec { 'getcomposer': # 'The HOME or COMPOSER_HOME environment variable must be set for composer to install correctly' environment => [ 'HOME=/root' ], #command => '/usr/bin/wget -O - https://getcomposer.org/installer | /usr/bin/php && /bin/mv composer.phar /usr/local/bin/composer', command => '/usr/local/bin/getcomposer', user => 'root', cwd => '/tmp', creates => '/usr/local/bin/composer', require => File['/usr/local/bin/getcomposer'], } } cron { "composer-self-update": command => "/usr/local/bin/composer self-update > /dev/null 2>&1", user => root, hour => "03", minute => "30", ensure => $provider ? { 'upstream' => present, default => absent, }, require => Exec['getcomposer'], } }