{"id":48,"date":"2007-10-31T20:00:16","date_gmt":"2007-11-01T01:00:16","guid":{"rendered":"http:\/\/blogs.cae.tntech.edu\/mwr\/2007\/10\/31\/client-file-access\/"},"modified":"2024-10-27T14:26:19","modified_gmt":"2024-10-27T14:26:19","slug":"client-file-access","status":"publish","type":"post","link":"https:\/\/sites.tntech.edu\/renfro\/2007\/10\/31\/client-file-access\/","title":{"rendered":"Client File Access"},"content":{"rendered":"<p>The infrastructures.org folks list two primary goals of what they call &#8220;<a href=\"http:\/\/www.infrastructures.org\/bootstrap\/fileclient.shtml\">client file access<\/a>&#8220;: first, consistent access to users&#8217; home directories, and second, consistent access to end-user applications. Some of the things they warn against, such as automounters and the \/net directory, we never thought of using to begin with. Their need to consider systems with limited disk space and a need to mount a software share via NFS is less of an issue with us, too: disks large enough to hold our regular software load are relatively cheap, so there shouldn&#8217;t be much of a problem there. And since we&#8217;re supposed to be deploying applications consistently via Puppet, there shouldn&#8217;t be any inconsistency in where an application is installed. As far as consistent access to the home directories, we accomplish this with a two-pronged solution in Puppet &#8212; one on the file server, and one on the clients:<br \/>\n<!--more--><br \/>\nOn the Debian file server, we include the following class:<\/p>\n<pre>\nclass nfs-server {\n  package { nfs-kernel-server: ensure =&gt; installed }\n\n  file { exports:\n    path =&gt; $operatingsystem ? {\n      default =&gt; \"\/etc\/exports\"\n    },\n    owner =&gt; root, group =&gt; root, mode =&gt; 644,\n    source =&gt; \"puppet:\/\/gold.cae.tntech.edu\/files\/apps\/nfs-server\/exports\",\n    require =&gt; Package[nfs-kernel-server]\n  }\n\n  service { nfs-kernel-server:\n    ensure =&gt; running,\n    enable =&gt; true,\n    hasstatus =&gt; true,\n    subscribe =&gt; [Package[nfs-kernel-server], File[exports]]\n  }\n  service { portmap:\n    ensure =&gt; running,\n    enable =&gt; true,\n  }\n}\n<\/pre>\n<p>We also include the following in its node definition:<\/p>\n<pre>\n    file {\n        \"\/etc\/exports.d\":\n        source  =&gt; \"puppet:\/\/\/files\/apps\/nfs-kernel-server\/exports.d\",\n        ensure  =&gt; directory,\n        ignore  =&gt; \".svn\",\n        purge   =&gt; true,\n        recurse =&gt; inf;\n    }\n\n    concatenated_file {\n        \"\/etc\/exports\":\n            dir =&gt; \"\/etc\/exports.d\";\n    }\n<\/pre>\n<p>Each file dropped in \/etc\/exports.d is a fragment of \/etc\/exports. Right now, we&#8217;re using one fragment per exported filesystem. As an example, here&#8217;s \/etc\/exports.d\/_opt_solaris_stow:<\/p>\n<pre>\n\/opt\/solaris\/stow \\\\\n        149.149.254.12(rw,sync,no_root_squash) \\\\\n        149.149.254.13(rw,sync,no_root_squash) \\\\\n        149.149.254.14(rw,sync,no_root_squash) \\\\\n        149.149.254.15(rw,sync,no_root_squash) \\\\\n        149.149.254.220(rw,sync,no_root_squash)\n<\/pre>\n<p>David Schmitt&#8217;s concatenated_file definition combines all the export fragments into one \/etc\/exports file:<\/p>\n<pre>\ndefine concatenated_file ($dir, $mode = 0644, $owner = root, $group = root)\n{\n    file {\n        $name:\n            ensure   =&gt; present,\n            checksum =&gt; md5,\n            mode     =&gt; $mode,\n            owner    =&gt; $owner,\n            group =&gt; $group;\n    }\n    exec { \"find ${dir} -maxdepth 1 -type f ! -name '*puppettmp' -print0 | sort -z | xargs -0 cat &gt; ${name}\":\n        refreshonly =&gt; true,\n        subscribe   =&gt; File[$dir],\n        alias       =&gt; \"concat_${name}\",\n    }\n}\ndefine concatenated_file_part ($dir, $content = '', $ensure = present,\n                               $mode = 0644, $owner = root, $group = root) {\n    file { \"${dir}\/${name}\":\n        ensure  =&gt; $ensure,\n        content =&gt; $content,\n        mode    =&gt; $mode,\n        owner   =&gt; $owner,\n        group   =&gt; $group,\n        alias   =&gt; \"cf_part_${name}\",\n    }\n}\n<\/pre>\n<p>On the client side, we just make sure we can mount the NFS share. For example:<\/p>\n<pre>\n    file {\n        \"\/home\/CAE\":\n            ensure =&gt; directory,\n            owner  =&gt; root,\n            group  =&gt; root,\n            mode   =&gt; 755,\n    }\n    mount { \"\/home\/CAE\":\n        require =&gt; File[\"\/home\/CAE\"],\n        atboot  =&gt; true,\n        fstype  =&gt; \"nfs\",\n        device  =&gt; \"files.cae.tntech.edu:\/home\/CAE\",\n        ensure  =&gt; mounted,\n        options =&gt; \"defaults\",\n        dump    =&gt; \"0\",\n        pass    =&gt; \"0\",\n    }\n    package { \"nfs-common\": ensure =&gt; installed }\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The infrastructures.org folks list two primary goals of what they call &#8220;client file access&#8220;: first, consistent access to users&#8217; home directories, and second, consistent access to end-user applications. Some of the things they warn against, such as automounters and the \/net directory, we never thought of using to begin with. Their need to consider systems &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/sites.tntech.edu\/renfro\/2007\/10\/31\/client-file-access\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Client File Access&#8221;<\/span><\/a><\/p>\n","protected":false},"author":87,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,7,16],"tags":[],"class_list":["post-48","post","type-post","status-publish","format-standard","hentry","category-debian","category-infrastructures","category-puppet","entry"],"_links":{"self":[{"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/posts\/48","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/users\/87"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/comments?post=48"}],"version-history":[{"count":1,"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/posts\/48\/revisions"}],"predecessor-version":[{"id":480,"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/posts\/48\/revisions\/480"}],"wp:attachment":[{"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/media?parent=48"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/categories?post=48"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/tags?post=48"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}