我正在更新包,如下面的代码?
package { '<packageName1>': ensure => latest, }
但它没有安装依赖包。
所以我加入了
exec {'testing':command =&gt; “apt-get build-dep packageName1'}
但仍然没有工作..如何实现安装依赖包。 还有其他好办法吗?
刚才我试过apt class.It也没用。
包括apt
apt::builddep { 'packagename': }
答案 0 :(得分:0)
以下是我们的一个木偶清单中的包裹部分的示例。这用于Ubuntu。
package { ["mysql-server", "libapache2-mod-auth-mysql", "php5-mysql"] :
ensure => present,
}
apt-get install puppet
设置所有内容,以便“package”资源类型知道如何安装包
示例2 我有一个没有安装mysql服务器的虚拟机 apt-get -s install mysql-server(模拟模式)给出了这个输出
$ apt-get -s install mysql-server
NOTE: This is only a simulation!
apt-get needs root privileges for real execution.
Keep also in mind that locking is deactivated,
so don't depend on the relevance to the real current situation!
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-2.6.32-38 linux-headers-2.6.32-38-server
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
libdbd-mysql-perl libdbi-perl libhtml-template-perl libnet-daemon-perl
libplrpc-perl mysql-client-5.1 mysql-client-core-5.1 mysql-server-5.1
mysql-server-core-5.1
Suggested packages:
dbishell libipc-sharedcache-perl tinyca mailx
The following NEW packages will be installed
libdbd-mysql-perl libdbi-perl libhtml-template-perl libnet-daemon-perl
libplrpc-perl mysql-client-5.1 mysql-client-core-5.1 mysql-server
mysql-server-5.1 mysql-server-core-5.1
0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
Inst libnet-daemon-perl (0.43-1 Ubuntu:10.04/lucid)
Inst libplrpc-perl (0.2020-2 Ubuntu:10.04/lucid)
Inst libdbi-perl (1.609-1build1 Ubuntu:10.04/lucid)
Inst libdbd-mysql-perl (4.012-1ubuntu1 Ubuntu:10.04/lucid)
Inst mysql-client-core-5.1 (5.1.72-0ubuntu0.10.04.1 Ubuntu:10.04/lucid-updates)
Inst mysql-client-5.1 (5.1.72-0ubuntu0.10.04.1 Ubuntu:10.04/lucid-updates)
Inst mysql-server-core-5.1 (5.1.72-0ubuntu0.10.04.1 Ubuntu:10.04/lucid-updates)
Inst mysql-server-5.1 (5.1.72-0ubuntu0.10.04.1 Ubuntu:10.04/lucid-updates)
Inst libhtml-template-perl (2.9-1 Ubuntu:10.04/lucid)
Inst mysql-server (5.1.72-0ubuntu0.10.04.1 Ubuntu:10.04/lucid-updates)
Conf libnet-daemon-perl (0.43-1 Ubuntu:10.04/lucid)
Conf libplrpc-perl (0.2020-2 Ubuntu:10.04/lucid)
Conf libdbi-perl (1.609-1build1 Ubuntu:10.04/lucid)
Conf libdbd-mysql-perl (4.012-1ubuntu1 Ubuntu:10.04/lucid)
Conf mysql-client-core-5.1 (5.1.72-0ubuntu0.10.04.1 Ubuntu:10.04/lucid-updates)
Conf mysql-client-5.1 (5.1.72-0ubuntu0.10.04.1 Ubuntu:10.04/lucid-updates)
Conf mysql-server-core-5.1 (5.1.72-0ubuntu0.10.04.1 Ubuntu:10.04/lucid-updates)
Conf mysql-server-5.1 (5.1.72-0ubuntu0.10.04.1 Ubuntu:10.04/lucid-updates)
Conf libhtml-template-perl (2.9-1 Ubuntu:10.04/lucid)
Conf mysql-server (5.1.72-0ubuntu0.10.04.1 Ubuntu:10.04/lucid-updates)
所以我制作了这样的清单文件
$ more p.pp
package { "mysql-server":
ensure => present
}
并像这样运行
$ sudo puppet apply p.pp
Warning: Could not retrieve fact fqdn
Notice: Compiled catalog for puppet1 in environment production in 0.12 seconds
Notice: /Stage[main]//Package[mysql-server]/ensure: ensure changed 'purged' to 'present'
Notice: Finished catalog run in 57.49 seconds
执行此操作后,mysql-server及其依赖项全部安装