1
votes

I'm trying to configure a Puppet module to install and configure tftp.

Here is the dependency chain in my module (an items to the right require the item on the left).

pxe::install --> pxe::config --> pxe::config2 --> pxe::service

pxe::config copies static files and directories only. In particular,

class pxe::config {
  File {
    owner => root,
    group => root,
    require => Class["pxe::install"],
  }

  file { "/var/lib/tftpboot":
    ensure => directory,
    recurse => true,
    purge => false,
    mode => 0755,
    source => "puppet:///modules/pxe/tftpboot",
  }

That gets copied successfully.

The problem is that I want to put a template inside of this directory. That's where pxe::config2 comes in. (I thought that putting it in the config2 would allow me to require pxe::config, and the directory /var/lib/tftpboot/pxelinux.cfg/ would already exist.)

class pxe::config2 {
  File {
    ensure => present,
    owner => root,
    group => root,
    mode => 0644,
    require => [ Class["pxe::install"], Class["pxe::config"] ],
  }

  file { "/var/lib/tftp/pxelinux.cfg/default":
    content => template("pxe/default.erb"),
  }

}

When I run the agent, I get the following error:

err: /File[/var/lib/tftp/pxelinux.cfg/default]/ensure: change from absent to present failed: Could not set 'present on ensure: No such file or directory - /var/lib/tftp/pxelinux.cfg/default.puppettmp_5977 at /etc/puppet/modules/pxe/manifests/config2.pp:14

That error indicates that the parent directory for the template does not exist. However, I checked after the agent ran, and /var/lib/tftp/pxelinux.cfg/ does exist but is empty.

Does anyone know how I can recursively copy the static directory /var/lib/tftp and the template /var/lib/tftp/pxelinux.cfg/default?

Thanks,

1
did you try to enforce that /var/lib/tftp/pxelinux.cfg is a directory? - Cristian Măgherușan-Stanciu

1 Answers

1
votes

It looks like it's maybe just a typo with the directory names - the file is going under the /var/lib/tftp directory instead of /var/lib/tftpboot.