Ask Your Question

Need help using puppet mount resource with credentials

asked 2016-05-12 11:44:43 -0600

vivek_yen gravatar image

I have have using the puppet documentation for the mount resource and hiera sections mainly. My goal is to mount a cifs share on centos7 system, using credentials. I am using puppet apply locally, I was successful in using hiera to store my user_name and password, So I have learned I am able to pull data from the .yaml file no problem.

My problem runs into how to use the mount resource to include username and password inside the mount resource. I have tried username => $username, and same for password, but it complains that username can't be used as parameter.

Now the options parameter has potential to use a credentials variable or file, is that my only option?

Any guidance or help would be much appreciated.

Thank you

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-05-13 03:25:10 -0600

Hi Vivek, I believe the puppet mount resource for samba(cifs) should be as follows - it doesnt take a username/password directly:

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

mount {"nameofmountpointr":
    device => "//servername/path/to/share",
    atboot => "true",
    ensure => "mounted",
    fstype => "cifs",
    options => "auto,credentials=/securedir/.sambacredentialsfile",
    require => [ File["/securedir/.sambacredentialsfile"], File["nameofmountpointdir"] ],



edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-05-12 11:44:43 -0600

Seen: 949 times

Last updated: May 13 '16