Why do you want to stop it ? I think you want to change the listen port.
So I think something like this will do the job :
package { 'apache2': ensure => installed, }
service { 'apache2':
ensure => running,
enable => true,
}
file { '/etc/apache2/conf.d/listen_port.conf':
content => "your_template.conf.erb",
require => Package['apache2'],
notify => Service['apache2'], # Refresh apache after the listen_port
is changed
}
package {'nginx':
ensure => installed,
require => Service['apache2'], # Install nginx after apache have been
restarted with another config
}
Le 13/05/2017 à 11:45, Anton Gorlov a écrit :
Hi.
I need stop service (apache) after it install from puppet.
platform is debian 9 and puppet version is 4.8.2
I my class i wrote:
========
class webpackages {
exec { 'apachechk':
command => "/bin/systemctl stop apache2;",
onlyif => "/bin/grep -c 'Listen 80' /etc/apache2/ports.conf",
}
package { 'libapache2-mpm-itk':
ensure => latest,
}
package { 'apache2':
require => Exec['apachechk'],
ensure => latest,
}
package { 'apache2-dev':
ensure => latest,
}
package { 'apache2-suexec-pristine':
ensure => latest,
}
package { 'apache2-utils':
ensure => latest,
}
package { 'apache2-bin':
ensure => latest,
}
package { 'apachetop':
ensure => latest,
}
package { 'libapache2-mod-rpaf':
ensure => latest,
}
package { 'nginx-light':
require => Exec['apachechk'],
ensure => latest,
}
}
===
but apache not stopping and install nginx is fail because port is busy
by apache
May 13 12:21:29 debian9-lab3 nginx[19538]: nginx: [emerg] listen() to
[::]:8…se)
May 13 12:21:29 debian9-lab3 nginx[19538]: nginx: [emerg] listen() to
0.0.0.…se)
May 13 12:21:29 debian9-lab3 nginx[19538]: nginx: [emerg] listen() to
[::]:8…se)
May 13 12:21:30 debian9-lab3 nginx[19538]: nginx: [emerg] listen() to
0.0.0.…se)
May 13 12:21:30 debian9-lab3 nginx[19538]: nginx: [emerg] listen() to
[::]:8…se)
May 13 12:21:30 debian9-lab3 nginx[19538]: nginx: [emerg] still could
not bind()
What is wrong and what is right way to do it?
--
You received this message because you are subscribed to the Google Groups "Puppet
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/7f0333ac-2aff-d936-3337-d1fb143019ae%40quake.fr.
For more options, visit https://groups.google.com/d/optout.