so I want to setup the yum repos first before I install any rpm packages, I don't want to add some requires in the package resource, so I am thiking about using contain. Here is the sample code
[root@maddog x]# cat profile/manifests/test.pp
class profile::test {
include profile::ngnix
include profile::base
Class['profile::base'] -> Class['profile::ngnix']
}
[root@maddog x]# cat profile/manifests/ngnix.pp
class profile::ngnix {
contain ::ngnix
}
[root@maddog x]# cat profile/manifests/base.pp
class profile::base {
contain repo::withproxy
}
this setup suppose to setup repo::withproxy before nginx is installed. but when I run puppet, it is not the case, see output below
[root@maddog x]# puppet apply -v -d --modulepath ./ -e 'include profile::test'
........
Info: Applying configuration version '1465812031'
Notice: /Stage[main]/Repo::Pre/File[/etc/yum.repos.d/readme.txt]/ensure: defined content as '{md5}6e1bd1543e9afba17699e4319f5ded0b'
Debug: /Stage[main]/Repo::Pre/File[/etc/yum.repos.d/readme.txt]: The container yum_repos_d will propagate my refresh event
Info: yum_repos_d: Scheduling refresh of Exec[yum_clean]
Debug: yum_repos_d: The container Class[Repo::Pre] will propagate my refresh event
Debug: Prefetching yum resources for package
Debug: Executing '/bin/rpm --version'
Debug: Executing '/bin/rpm -qa --nosignature --nodigest --qf '%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\n''
Debug: Executing '/bin/rpm -q nginx --nosignature --nodigest --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\n'
Debug: Executing '/usr/bin/yum -d 0 -e 0 -y list nginx'
Error: Execution of '/usr/bin/yum -d 0 -e 0 -y list nginx' returned 1: Error: No matching Packages to list
Error: /Stage[main]/Ngnix/Package[nginx]/ensure: change from absent to present failed: Execution of '/usr/bin/yum -d 0 -e 0 -y list nginx' returned 1: Error: No matching Packages to list
Notice: /Stage[main]/Repo/Repo::Yumrepo[nginx]/File[/etc/yum.repos.d/nginx.repo]/ensure: defined content as '{md5}56b0832c7af04b058a111e3d3ec571c0'
Info: /Stage[main]/Repo/Repo::Yumrepo[nginx]/File[/etc/yum.repos.d/nginx.repo]: Scheduling refresh of Exec[yum_clean]
Debug: /Stage[main]/Repo/Repo::Yumrepo[nginx]/File[/etc/yum.repos.d/nginx.repo]: The container Repo::Yumrepo[nginx] will propagate my refresh event
Debug: Repo::Yumrepo[nginx]: The container Class[Repo] will propagate my refresh event
Notice: /Stage[main]/Repo/Repo::Yumrepo[node]/File[/etc/yum.repos.d/node.repo]/ensure: defined content as '{md5}17aff07773ea768
apparently it is installing nginx before yum repo files are configured, what did I do wrong here? I am using **puppet-3.7.4-1.el6.noarch**, I have the sample puppet code at [here](https://bitbucket.org/woosley/puppet/src/2e872a1946b20ae99eacd8286940e89e824292b5?at=master)
↧