Puppet不尊重'require'模块

时间:2015-03-10 10:03:43

标签: ruby puppet

我创建了一个模块来添加用户,如下所示:

user { 'test':
    ensure => 'present',
    comment => 'Test User',
    home => '/home/test',
    shell => '/bin/bash',
    managehome => 'true',
    gid => 'postgres',
    groups => 'users',
    password => '$1$PIp.c9J6$gdAyd76OhBk7n9asda80wm0',
    require => [ Package['rubygem-ruby-shadow'], Class['postgres'] ],
}

它需要类postgres,因为我需要将其主要组分配给postgres,而rubygem-ruby-shadow依赖项用于密码设置。

我的问题是木偶不符合这些要求。 Puppet将始终在rubygem-ruby-shadow之前首先执行useradd模块,这会导致密码设置失败。我也尝试在与useradd相同的类中包含rubygem-ruby-shadow,但无济于事。

running puppet agent -t上的输出:

linux-z14x:~ # puppet agent -t
info: Caching catalog for linux-z14x.playground.local
info: /User[test]: Provider useradd does not support features manages_passwords; not managing attribute password
info: Applying configuration version '1425978163'
notice: /Stage[main]/Users/Package[rubygem-ruby-shadow]/ensure: created
notice: /User[test]/ensure: created
notice: Finished catalog run in 78.19 seconds

第二次运行:

linux-z14x:~ # puppet agent -t
info: Caching catalog for linux-z14x.playground.local
info: Applying configuration version '1425978163'
notice: /Stage[main]/Users/User[test]/password: changed password
notice: Finished catalog run in 74.79 seconds

我的rubygem-ruby-shadow课程:

package { 'rubygem-ruby-shadow':
        ensure => 'installed',
        require => Class['myrepo'],
        provider => 'zypper',
}

如何在useradd之前先运行rubygem-ruby-shadow模块?

Puppet master版本是3.7.4-1(在CentOS上),puppet客户端是2.6.12-0.10.1(在SLES 11 SP2上)。

感谢。

1 个答案:

答案 0 :(得分:1)

这很不幸。提供程序在代理初始化期间检测到ruby-shadow不存在,并且在事务期间不会更新其功能。

这可能是Puppet的限制,可能会在更新的版本中修复(您使用的是什么?)

我确实尝试确保在任何地方提供ruby-shadow以及Puppet本身,以避免这个问题。

相关问题