Héctor Rivas
2010-Jun-08 09:39 UTC
[Puppet Users] Puppet AIX contributions and small AIX nfs mountpoint snippet
Hello, First I want to point that I am completely new in puppet, and I am playing a little bit around with it. I am still learning the language. In our site, we have AIX and Linux systems. I find that puppet has some lacks on AIX, and probably we will code some providers and recipes. Is there anybody working extending puppet for AIX? How is the best way to share our improvements and colaborate? AIX have two main advantages that might make providers and new recipes easy to implement: * Almost everything can be done with commands * it is homogenous: most commands have very similar syntax and output, it does not change between versions... An example of this can be this snippet that I paste here. # Define to implement AIX nfs mountpoints. It is based on commands lsnfsmnt and mknfsmnt. # It will: # * Check if the mountpoint is defined. # * If is defined, check the options. # * If options change, remove it and create it (it will umount if needed) # # ensure: # * present: Create/Change it in configuration and running mounts # * absent: Create/Change it in configuration and running mounts # * configured: Change only configuration # * mounted: Do not change configuration, just mount it. # * umounted: Do not change configuration, just umount it. # * unconfigured: Do not umount it, remove configuration define aix_nfsmnt( $ensure=present, # Valid values: $force=false, $mountpoint="", $remotepath, $nodename, $type="nfs", $readtype="rw", # rw|ro $when="", # bg|fg $softhard="", # soft | hard $secure="", # more secure true|false (-s|-n) $intr="", # Interrupt true - false $retry="", $rsize="", $wsize="", $timeo="", $port="", $acregmin="", $acregmax="", $acdirmin="", $acdirmax="", $actimeo="", $biods="", $suid="", # set uid true or false $dev="", # devs true or false $shortdev="", # sort dev true or false $auto="", # Auto value $vers="", $proto="any", $llock="", # file locking true or false (Not documented) -L|- l $acl="", #acl true|false -J|-j $grpid="", #inherit group false|true -g|-G $posix="", # v2 posix pathconf $retrans="") { # Get the default name as mountpoint if no mountpoint given $_mountpoint = $mountpoint? { "" => $name, default => $mountpoint, } # Possible options $_type = $type? { "" => "", default => "-m $type"} $_readtype = $readtype? { "" => "", default => "-t $readtype" } $_when = $when? { "" => "", default => "-w $when" } $_softhard = $softhard? { "soft" => "-S", "hard" => "-H", default => "", } #$_secure = $secure? { true => "-s", false => "-n", default => "", } $_secure = $secure? { "" => "", default => "-M $secure", } $_intr = $intr? { false => "-e", true => "-E", default => "", } $_retry = $retry? { "" => "", default => "-r $retry", } $_rsize = $rsize? { "" => "", default => "-b $rsize", } $_wsize = $wsize? { "" => "", default => "-c $wsize", } $_timeo = $timeo? { "" => "", default => "-o $timeo", } $_port = $port? { "" => "", default => "-P $port", } $_acregmin = $acregmin? { "" => "", default => "-u $acregmin", } $_acregmax = $acregmax? { "" => "", default => "-U $acregmax", } $_acdirmin = $acdirmin? { "" => "", default => "-v $acdirmin", } $_acdirmax = $acdirmax? { "" => "", default => "-V $acdirmax", } $_actimeo = $actimeo? { "" => "", default => "-o $actimeo", } $_biods = $biods? { "" => "", default => "-p $biods", } $_suid = $suid? { false => "-y", true => "-Y", default => "", } $_dev = $dev? { false => "-z", true => "-Z", default => "", } $_shortdev = $shortdev? { false => "-x", true => "-X", default => "-X", } $_auto = $auto? { false => "-a", true => "-A", default => "", } $_vers = $vers? { "" => "", default => "-K $vers", } $_proto = $proto? { "" => "", default => "-k $proto", } $_llock = $llock? { false => "-l", true => "-L", default => "", } $_acl = $acl? { false => "-j", true => "-J", default => "", } $_grpid = $grpid? { false => "-g", true => "-G", default => "", } $_posix = $posix? { false => "-q", true => "-Q", default => "- q", } $_retrans = $retrans? { "" => "", default => "-R $retrans", } $_force_umount = $force? { true => "-f", default => "", } # Which action perform, and if it is persistent or not case "$ensure" { present: { $mountaction="-B" $domount=true $docreation=true } absent: { $mountaction="-B" $domount=true $docreation=false } mounted: { $mountaction="-I" $domount=true $docreation=true } umounted: { $mountaction="-I" $domount=true $docreation=false } configured: { $mountaction="-N" $domount=false $docreation=true } unconfigured:{ $mountaction="-N" $domount=false $docreation=false } default: { fail("Unkown ensure value ''$ensure''") } } $expected_lsnfsmnt_options = "$_mountpoint:$remotepath:$nodename: $type:$readtype:$when:$_softhard:$secure:$_intr:$retry:$rsize:$wsize: $timeo:$port:$acregmin:$acregmax:$acdirmin:$acdirmax:$actimeo:$biods: $_suid:$_dev:$_shortdev:$_auto:$vers:$proto:$_llock:$_acl:$_grpid: $_posix:$retrans" $nfsmnt_args="$mountaction -f $_mountpoint -d $remotepath -h $nodename $_type $_readtype $_when $_softhard $_secure $_intr $_retry $_rsize $_wsize $_timeo $_port $_acregmin $_acregmax $_acdirmin $_acdirmax $_actimeo $_biods $_suid $_dev $_shortdev $_auto $_vers $_proto $_llock $_acl $_grpid $_posix $_retrans" #notify{"The value ''expected_lsnfsmnt_options_cmd'' is: $ {expected_lsnfsmnt_options}": } #notify{"The value ''nfsmnt_args'' is: ${nfsmnt_args}": } # Create mountpoint if needed file { $_mountpoint: ensure => directory, } # Commands to umount the fs before execute the rmnfsmnt. if $domount { $pre_rmnfsmnt_cmd="/usr/sbin/umount $_force_umount $_mountpoint" $postfail_rmnfsmnt_cmd="(RET=\$?; /usr/sbin/mount $_mountpoint; exit \$RET)" } else { $pre_rmnfsmnt_cmd="/usr/bin/true" $postfail_rmnfsmnt_cmd="(RET=\$?; exit \$RET)" } if $docreation { # Remove the old definition if options change. To check it, it will list the options in table mode. # Umount before remove if needed. exec{"rmnfsmnt-$title": command => "$pre_rmnfsmnt_cmd && \ /usr/sbin/rmnfsmnt -f $_mountpoint || \ $postfail_rmnfsmnt_cmd", cwd => "/", unless => "/usr/sbin/lsnfsmnt -c $_mountpoint | /usr/bin/grep -e ''^ $expected_lsnfsmnt_options\$''", } # Create the definition. It will remove previous if needed. If previous definition has # same options, rmnfsmnt will not be executed, and the unless attribute will prevent this # command to execute. exec{"mknfsmnt-$title": require => Exec["rmnfsmnt-$title"], command => "/usr/sbin/mknfsmnt $nfsmnt_args", cwd => "/", unless => "/usr/sbin/lsnfsmnt -c $_mountpoint | /usr/bin/grep -e ''$_mountpoint:$remotepath:$nodename''", } } else { exec{"rmnfsmnt-$title": command => "$pre_rmnfsmnt_cmd && \ /usr/sbin/rmnfsmnt -f $_mountpoint || \ $postfail_rmnfsmnt_cmd", cwd => "/", onlyif => "/usr/sbin/lsnfsmnt -c $_mountpoint", } } } class aix_nfs_sample_mountpoint { $mountpoint = "/mnt/remotedir" aix_nfsmnt{$mountpoint: remotepath => "/export/adir", nodename => "nfsserver", when=>"fg", softhard=>"soft", secure=>"sys", suid=>false, dev=>false, # shortdev=>false, auto=>true, llock=>false, intr=>true, acl=>true, grpid=>false, # posix=>false, retry=>8, retrans=>5, timeo=>5, vers=>4, type=>"nfs4", force=>true, ensure=>present, } } -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
donavan
2010-Jun-08 18:31 UTC
[Puppet Users] Re: Puppet AIX contributions and small AIX nfs mountpoint snippet
On Jun 8, 2:39 am, Héctor Rivas <key...@gmail.com> wrote:> Is there anybody working extending puppet for AIX? > How is the best way to share our improvements and colaborate?Hector, I believe Andrew Forgue did a lot (all?) of the existing AIX work. You can see an example here http://projects.puppetlabs.com/issues/2864. Most of the development work is hosted github.com, as far as I know. Someone over on http://groups.google.com/group/puppet-dev/ should be able to point you to a Getting Started type doc. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
James Turnbull
2010-Jun-08 18:49 UTC
Re: [Puppet Users] Re: Puppet AIX contributions and small AIX nfs mountpoint snippet
donavan wrote:> On Jun 8, 2:39 am, Héctor Rivas <key...@gmail.com> wrote: >> Is there anybody working extending puppet for AIX? >> How is the best way to share our improvements and colaborate? > > Hector, > > I believe Andrew Forgue did a lot (all?) of the existing AIX work. You > can see an example here http://projects.puppetlabs.com/issues/2864. > > Most of the development work is hosted github.com, as far as I know. > Someone over on http://groups.google.com/group/puppet-dev/ should be > able to point you to a Getting Started type doc. >You can find a getting started document at: http://projects.puppetlabs.com/projects/puppet/wiki/Development_Development_Lifecycle Basically you just need to check-out the Puppet repository from GitHub: http://github.com/reductivelabs/puppet Make any changes you want, log tickets and send patches to the puppet-dev list for comment and peer review. Once they''re reviewed they can be merged into core. Thanks James Turnbull -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Héctor Rivas Gándara
2010-Jun-09 07:33 UTC
Re: [Puppet Users] Re: Puppet AIX contributions and small AIX nfs mountpoint snippet
On Tue, Jun 8, 2010 at 8:31 PM, donavan <donavan@desinc.net> wrote:> > On Jun 8, 2:39 am, Héctor Rivas <key...@gmail.com> wrote: > > Is there anybody working extending puppet for AIX? > > How is the best way to share our improvements and colaborate? > > I believe Andrew Forgue did a lot (all?) of the existing AIX work. You > can see an example here http://projects.puppetlabs.com/issues/2864. > > Most of the development work is hosted github.com, as far as I know. > Someone over on http://groups.google.com/group/puppet-dev/ should be > able to point you to a Getting Started type doc.Thank you for your replies. I will start playing a little bit more. I will ask Andrew for his progress. -- Atentamente Héctor Rivas -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.