我是傀儡的新手并且想要尝试一些东西。 这个简单的试用清单应该安装PHP,然后安装NGINX而不修改任何配置文件。
但每次我尝试我都会安装不需要的apache2。 我在Ubuntu Server 12.04上,使用“http://apt.puppetlabs.com精确主”。 如果有人能发现罪魁祸首,我会贬低它。 如何使用puppet调试此类问题?
我试过的东西......在apt-get purge apache * php * nginx *
之后清单:
###### APT
include "apt"
apt::ppa { 'ppa:ondrej/php5': }
apt::key { "ondrej": key => "E5267A6C" }
apt::ppa { 'ppa:nginx/stable': }
apt::key { "nginx": key => "C300EE8C" }
###### PHP
$php_packages = [
"php5",
"php5-fpm",
"php5-common",
"php5-cli",
"php5-curl",
"php5-ldap",
"php5-mysql",
"php5-pgsql",
"php5-gd",
]
package { $php_packages:
ensure => 'installed',
require => Apt::Ppa['ppa:ondrej/php5' ],
install_options => ['--no-install-recommends'],
}
service { 'php5-fpm':
ensure => running,
require => Package['php5-fpm'],
}
###### NGINX
package { 'nginx':
ensure => 'installed',
require => [
Package['php5-fpm'],
Apt::Ppa['ppa:nginx/stable' ],
],
notify => Service['php5-fpm'],
install_options => ['--no-install-recommends'],
}
package { 'apache2':
ensure => "purged",
}
service { 'nginx':
ensure => running,
require => Package['nginx'],
}
结果: 1)首先运行...
?#> puppet agent --no-daemonize --test --verbose
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for puppetclient.net
Info: Applying configuration version '1418303395'
Notice: /Stage[main]/Profiles::Userservices_common/Package[php5-mysql]/ensure: ensure changed 'purged' to 'present'
Notice: /Stage[main]/Profiles::Userservices_common/Package[php5-gd]/ensure: ensure changed 'purged' to 'present'
Notice: /Stage[main]/Profiles::Userservices_common/Package[php5]/ensure: ensure changed 'purged' to 'present'
Notice: /Stage[main]/Profiles::Userservices_common/Package[php5-fpm]/ensure: ensure changed 'purged' to 'present'
Notice: /Stage[main]/Profiles::Userservices_common/Package[nginx]/ensure: ensure changed 'purged' to 'present'
Info: /Package[nginx]: Scheduling refresh of Service[php5-fpm]
Notice: /Stage[main]/Profiles::Userservices_common/Package[php5-ldap]/ensure: ensure changed 'purged' to 'present'
Notice: /Stage[main]/Profiles::Userservices_common/Package[php5-pgsql]/ensure: ensure changed 'purged' to 'present'
Notice: /Stage[main]/Profiles::Userservices_common/Package[php5-curl]/ensure: ensure changed 'purged' to 'present'
Notice: /Stage[main]/Profiles::Userservices_common/Service[nginx]/ensure: ensure changed 'stopped' to 'running'
Info: /Stage[main]/Profiles::Userservices_common/Service[nginx]: Unscheduling refresh on Service[nginx]
Notice: /Stage[main]/Profiles::Userservices_common/Service[php5-fpm]: Triggered 'refresh' from 1 events
Notice: Finished catalog run in 86.97 seconds
2)检查apache文件夹... 为什么一直安装apache2 ???
?#> la /etc/apa*
total 64K
drwxr-xr-x 2 root root 138 2014-12-11 15:10 conf-available
drwxr-xr-x 2 root root 138 2014-12-11 15:10 conf-enabled
drwxr-xr-x 2 root root 8,0K 2014-12-11 15:10 mods-available
drwxr-xr-x 2 root root 4,0K 2014-12-11 15:10 mods-enabled
drwxr-xr-x 2 root root 52 2014-12-11 15:10 sites-available
drwxr-xr-x 2 root root 29 2014-12-11 15:10 sites-enabled
-rw-r--r-- 1 root root 7,0K 2014-07-23 00:16 apache2.conf
-rw-r--r-- 1 root root 1,8K 2014-07-23 00:16 envvars
-rw-r--r-- 1 root root 31K 2014-07-23 00:16 magic
-rw-r--r-- 1 root root 320 2014-07-23 00:16 ports.conf
3)第二次运行......
?#> puppet agent --no-daemonize --test --verbose
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for puppetclient.net
Info: Applying configuration version '1418303395'
Notice: /Stage[main]/Profiles::Userservices_common/Package[apache2]/ensure: ensure changed '2.4.10-1+deb.sury.org~precise+1' to 'purged'
Notice: /Stage[main]/Profiles::Userservices_common/Service[nginx]/ensure: ensure changed 'stopped' to 'running'
Info: /Stage[main]/Profiles::Userservices_common/Service[nginx]: Unscheduling refresh on Service[nginx]
Notice: Finished catalog run in 12.32 seconds
4)检查apache文件夹... 好的,我理解,确保=> “清除”会起作用。
?#> la /etc/apa*
ls: cannot access /etc/apa*: No such file or directory
答案 0 :(得分:1)
,因为
# apt-cache show php5|grep Depends
Depends: libapache2-mod-php5 (>= 5.3.3-7+squeeze19) | libapache2-mod-php5filter (>= 5.3.3-7+squeeze19) | php5-cgi (>= 5.3.3-7+squeeze19), php5-common (>= 5.3.3-7+squeeze19)
和
# apt-cache show libapache2-mod-php5 |grep Depends
Depends: libbz2-1.0, libc6 (>= 2.11), libcomerr2 (>= 1.01), libdb4.8, libgssapi-krb5-2 (>= 1.6.dfsg.2), libk5crypto3 (>= 1.6.dfsg.2), libkrb5-3 (>= 1.6.dfsg.2), libonig2 (>= 5.2.0), libpcre3 (>= 7.7), libqdbm14 (>= 1.8.74), libssl0.9.8 (>= 0.9.8m-1), libxml2 (>= 2.7.4), zlib1g (>= 1:1.1.4), mime-support, apache2-mpm-prefork (>> 2.0.52) | apache2-mpm-itk, apache2.2-common, php5-common (= 5.3.3-7+squeeze19), libmagic1, ucf, tzdata
Depends: libbz2-1.0, libc6 (>= 2.11), libcomerr2 (>= 1.01), libdb4.8, libgssapi-krb5-2 (>= 1.6.dfsg.2), libk5crypto3 (>= 1.6.dfsg.2), libkrb5-3 (>= 1.6.dfsg.2), libonig2 (>= 5.2.0), libpcre3 (>= 7.7), libqdbm14 (>= 1.8.74), libssl0.9.8 (>= 0.9.8m-1), libxml2 (>= 2.7.4), zlib1g (>= 1:1.1.4), mime-support, apache2-mpm-prefork (>> 2.0.52) | apache2-mpm-itk, apache2.2-common, php5-common (= 5.3.3-7+squeeze23), libmagic1, ucf, tzdata
你的清单是安装php5,这取决于apache。我从Debian 6.0获得了这些版本/依赖项,但12.04LTS将是类似的