Puppeteers,

My environment has NIS with all my users precreated. I have a module which
creates home directories for them along with their authorized key file and a
customized bashrc.

class hostinghome {

  createhostinghome {
    someuser: username => "someuser"; # Of course I actually have a lot more
users.
  }

}

define createhostinghome ( $username ) {
    file {
      "/home/$username" :
        ensure => directory,
        mode => 755,
        owner => "$username",
        require => [ Service['ypbind'] ];

      "/home/$username/.ssh" :
        ensure => directory,
        require => [ File["/home/$username"] ],
        mode => 755,
        owner => "$username";

      "/home/$username/.bashrc" :
        ensure => present,
        source => "puppet:///modules/hostinghome/bashrc",
        require => [ File["/home/$username"] ],
        mode => 755,
        owner => "$username";

      "/home/$username/.bash_profile" :
        ensure => present,
        source => "puppet:///modules/hostinghome/bash_profile",
        require => [ File["/home/$username"] ],
        mode => 755,
        owner => "$username";

      "/home/$username/.ssh/authorized_keys" :
        ensure => present,
        source => "puppet:///modules/hostinghome/$username.id_rsa.pub",
        require => [ File["/home/$username/.ssh"] ],
        mode => 755,
        owner => "$username";

    }
}

I also have a module for ypbind which the createhostinghome function
requires:

class nis::client {
include portmap
 package {
ypbind: ensure => latest;
}

service {
ypbind:
enable => true,
ensure => true,
subscribe => [ File["/etc/sysconfig/network"], File["/etc/yp.conf"],
File["/etc/nsswitch.conf"] ],
require => [Package["ypbind"], Service["portmap"]];
}

file {
"/etc/yp.conf":
mode => 644, owner => root, group => root,
ensure => file,
content => template("nis/yp.conf.erb"),
require => Package["ypbind"];
 "/etc/sysconfig/network":
mode => 644, owner => root, group => root,
ensure => file,
content => template("nis/network.erb");

"/etc/nsswitch.conf":
mode => 644, owner => root, group => root,
ensure => file,
content => template("nis/nsswitch.conf.erb");
}
 exec { "ypdomainname $my_nis_domain": path => "/usr/bin:/usr/sbin:/bin"; }
}

The createhostinghome function fails on first run every time with the
following error:

Jul 12 17:14:16 hostname puppetd[3374]:
(//nis::client/File[/etc/sysconfig/network]/content) content changed
'{md5}72d98a65b2c24b801e6146823237621b' to 'unknown checksum'c
Jul 12 17:14:17 hostname ypbind: bound to NIS server
dns.vmhosted.domainname.com
Jul 12 17:14:18 hostname puppetd[3374]:
(//nis::client/Service[ypbind]/ensure) ensure changed 'stopped' to
'running'e
Jul 12 17:14:18 hostname puppetd[3374]: (//nis::client/Service[ypbind])
Triggering 'refresh' from 3 dependenciesr
Jul 12 17:14:19 hostname ypbind: bound to NIS server
dns.vmhosted.domainname.com
Jul 12 17:14:19 hostname puppetd[3374]:
(//hostinghome/Createhostinghome[someuser]/File[/home/someuser]/ensure)
change from absent to directory failed: Could not set directory on ensure:
Could not find user someuser at
/etc/puppet/modules/hostinghome/manifests/init.pp:66c

On the second run the home directories and ownership are set correctly. I've
played with various require statements as well as before with no success.
Any help or suggestions would be appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to