Need help using puppet mount resource with username and password

224 views
Skip to first unread message

spin...@gmail.com

unread,
May 12, 2016, 12:44:18 PM5/12/16
to Puppet Users
 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

jcbollinger

unread,
May 13, 2016, 9:25:22 AM5/13/16
to Puppet Users


On Thursday, May 12, 2016 at 11:44:18 AM UTC-5, spin...@gmail.com wrote:
 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.



Perhaps you should review the Mount type's documentation.  The supported attributes are enumerated there, and 'username' is not among them.  Many of these attributes map fairly directly onto the fields of /etc/fstab, as managing that file or its analog is one of the primary aspects of managing mounts.  This resource type does not perform ad hoc filesystem mounting; rather it records the mount information in fstab, then relies on that if it needs to ensure the file system mounted.

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



The options field of fstab is where you would need to store credentials or information pointing to credentials, and the options property of the Mount resource is the one that serves for managing that.  Details of how to record or refer to credentials via the mount options depend on remote filesystem type, OS version, and perhaps other considerations.  You should really consult the documentation for your target environment, but there are online docs for CIFS mounts that are likely to be quite close.

If those particular docs exactly describe the situation for your environment, then your alternatives involve the user, password, and credentials mount options, and environment variables USER and PASSWD.  The CIFS mount service also recognizes synonyms for some option names, including 'username' as a synonym for 'user'.  Do read the appropriate docs for full details.


John

Reply all
Reply to author
Forward
0 new messages