1

I have a Puppet module that I use to mount a CIFS share. Both the puppetmaster and the agents are running SLES 11.

The mount works manually with this command:

mount.cifs //servername/path/to/share /opt/some/dir -o auto,credentials=/root/.smbcred

But when puppet tries to mount it, it fails:

hostname:~ # puppet agent --test --verbose
notice: /Stage[main]/module_name/Mount[/opt/some/dir]/ensure: defined 'ensure' as 'mounted'
err: /Stage[main]/module_name/Mount[/opt/some/dir]: Could not evaluate: Field 'device' is required

Here's the relevant section of the init.pp for the module:

file { "/opt/some/dir":
    ensure => directory,
}

file { "/root/.smbcred":
    owner   => root,
    group   => root,
    mode    => 0644,
    ensure  => present,
    content =>  "user=username\npass=password\ndomain=$domain\n",
}

mount {"/opt/some/dir":
    device => "//servername/path/to/share",
    name => "/opt/some/dir",
    atboot => "true",
    ensure => "mounted",
    fstype => "cifs",
    options => "auto,credentials=/root/.smbcred",
    require => [ File["/root/.smbcred"], File["/opt/some/dir"] ],
}

The credentials file does get written and the directory does get created. But the mount just fails. Any ideas?

1
  • The style guide suggests quoting variables in donne quoted strings like "#{this}". FYI. – Yolo Perdiem Nov 27 '13 at 13:30
1

name field is redundant

Does the mount work after the credentials file gets written and the dir created?

run it with --debug

are there errors in /etc/fstab ?

1
  • Yep. It was an error in the /etc/fstab file. I removed the offending line and puppet works fine. Now I have to figure out what put the bad line into the fstab. The hunt continues. – Ed Manet Nov 25 '13 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.