puppet module install $module
在 Centos 7 中似乎无法正常工作。
[root@client modules]# puppet module install spacepants-ds_389
Notice: Preparing to install into /etc/puppet/modules ...
Notice: Downloading from https://forgeapi.puppetlabs.com ...
Notice: Installing -- do not interrupt ...
/etc/puppet/modules
└─┬ spacepants-ds_389 (v1.1.7)
├─┬ puppetlabs-concat (v4.2.1)
│ └── puppetlabs-stdlib (v4.25.1)
└─┬ puppetlabs-inifile (v2.5.0)
└── puppetlabs-translate (v1.2.0)
该模块下载得很好,似乎满足了所需的依赖关系,但列出结果指出依赖关系未满足:
[root@client modules]# puppet module list --tree
Warning: Missing dependency 'puppetlabs-concat':
'spacepants-ds_389' (v1.1.7) requires 'puppetlabs-concat' (>=4.0.0 <5.0.0)
Warning: Missing dependency 'puppetlabs-inifile':
'spacepants-ds_389' (v1.1.7) requires 'puppetlabs-inifile' (>=1.0.0 <3.0.0)
Warning: Missing dependency 'puppetlabs-stdlib':
'spacepants-ds_389' (v1.1.7) requires 'puppetlabs-stdlib' (>=4.2.0 <5.0.0)
/etc/puppet/modules
├─┬ spacepants-ds_389 (v1.1.7)
│ ├── UNMET DEPENDENCY puppetlabs-concat (>=4.0.0 <5.0.0)
│ ├── UNMET DEPENDENCY puppetlabs-inifile (>=1.0.0 <3.0.0)
│ └── UNMET DEPENDENCY puppetlabs-stdlib (>=4.2.0 <5.0.0)
├─┬ puppetlabs-inifile (v2.5.0)
│ └── puppetlabs-translate (v1.2.0)
└─┬ puppetlabs-concat (v4.2.1)
└── puppetlabs-stdlib (v4.25.1)
/usr/share/puppet/modules (no modules installed)
这是为什么?
puppetlabs-concat v4.2.1 >= 4.0.0
puppetlabs-inifile v2.5.0 >= 1.0.0
puppetlabs-stdlib v4.25.1 >= 4.2.0
版本号对我来说看起来不错。
答案1
centos 7 上 puppet 的默认版本存在问题。
安装 puppet 5 的 repo 并使用效果更好:
# yum erase puppet
# rpm -Uvh https://yum.puppetlabs.com/puppet5-release-el-7.noarch.rpm
# yum install puppet
然后一切正常:
[root@client ~]# /opt/puppetlabs/bin/puppet module install spacepants-ds_389
Notice: Preparing to install into /etc/puppetlabs/code/environments/production/modules ...
Notice: Downloading from https://forgeapi.puppet.com ...
Notice: Installing -- do not interrupt ...
/etc/puppetlabs/code/environments/production/modules
└─┬ spacepants-ds_389 (v1.1.7)
├─┬ puppetlabs-concat (v4.2.1)
│ └── puppetlabs-stdlib (v4.25.1)
└─┬ puppetlabs-inifile (v2.5.0)
└── puppetlabs-translate (v1.2.0)
[root@client ~]# /opt/puppetlabs/bin/puppet module list --tree
/etc/puppetlabs/code/environments/production/modules
└─┬ spacepants-ds_389 (v1.1.7)
├─┬ puppetlabs-concat (v4.2.1)
│ └── puppetlabs-stdlib (v4.25.1)
└─┬ puppetlabs-inifile (v2.5.0)
└── puppetlabs-translate (v1.2.0)
/etc/puppetlabs/code/modules (no modules installed)
/opt/puppetlabs/puppet/modules (no modules installed)