Giter Club home page Giter Club logo

autofs-puppet's People

Watchers

 avatar  avatar  avatar

autofs-puppet's Issues

Service autofs requires package autofs?

My initial puppet run seems to fail because of an ordering issue.
Error: /Stage[main]/Autofs::Service/Service[autofs]/ensure: change from stopped to running failed: Could not start Service[autofs]: Execution of '/bin/systemctl start autofs' returned 6: Failed to issue method call: Unit autofs.service failed to load: No such file or directory.
It tries to start autofs before the packages has been installed.
Does service.pp need to require the package autofs?

mount.pp - do you really need to ensure $mount directory?

We use direct maps for mounting, and for this we found we needed to modify mount.pp to not make the directory for us. Doesn't automount always create this directory anyhow?

I didn't do this modification a coworker did, so just sharing it here instead of making a pull request.

Comments show what was removed:

autofs does this for us, this freaks out if you use the

same mount point twice.

example: /filesystem1 /filesystem2 both use /- which is

a reserved autofs argument. This creates /-

#file { $mount:

ensure => directory,

require => Package[ 'autofs' ],

#}

file { $mapfile:
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
content => template('autofs/auto.map.erb'),

require => File[ $mount ],

notify  => Service[ 'autofs' ],

}

Specify a mount point and map file that is deployed only once

The idea behind this is to have an entry in the /etc/auto.master and the corresponding file .autofs, but just deployed one time (/etc/auto.master.d/custom.autofs). After that we keep the entry in the auto.master, but do not touch the deployed .autofs file anymore. Similar to replace option of File resource in Puppet.

Refactor code with typed Parameters

Currently the Autofs module uses parameters specific to each class. This is not optimal as it makes it more difficult for new users to easily manage part of the autofs module separate from each other.

All non-defined type parameters may be moved into a params.pp class pending review

RHEL & CentOS 7 +dir feature

# Include /etc/auto.master.d/*.autofs
# The included files must conform to the format of this file.
+dir:/etc/auto.master.d

It would be nice to have a flag that we could define as true in Hiera to activate this line in the /etc/auto.master. Then we just need to point the auto_name.autofs file inside the auto.master.d directory and everything will work as expected.

autofs::mapOptions?

I like the looks of this, simple and works out of the box with minimal dependencies. One suggestion I had was to just make "mapOptions" be an attribute (default {}) on the "init" class so that in YAML its:

autofs::mapOptions:
  (the rest)

Then you wouldn't need the direct hiera call, you could just pull it in via options?

Just a thought. ;)

~tommy

The $ensure parameter to concat::fragment is deprecated

when I run the module with any configuration, it returns this warning message for every autofs entry:

Warning: Scope(Concat::Fragment[autofs::fragment preamble map directory]): The $ensure parameter to concat::fragment is deprecated and has no effect.

In Concat module manual, using ensure defining concat::fragment is deprecated since v2.0.0

Define: concat::fragment
...
ensure

Deprecated as of concat v2.0.0. Has no effect.

Multiple direct mounts

Hi
Could be me, but it seems that because of concat we cannot have more than one direct map as such

autofs::mount { 'fixes':
mount => '/-',
mapfile => '/etc/auto.fixes',
mapcontents => ['/fixes -rw,soft,bg,intr,retry=3, nas:/vol/fixes'],
options => '--timeout=120',
order => 01
}

autofs::mount { 'cnunix':
mount => '/-',
mapfile => '/etc/auto.cnunix',
mapcontents => ['/cnunix -rw,soft,timeo=600,bg,intr,retry=3 nas:/vol/nasp_cnunix'],
options => '--timeout=120',
order => 02
}

It yields the following

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Concat::Fragment[autofs::fragment preamble /-] is already declared in file /etc/puppet/environments/KT_ITOPS_Sandbox_ccv_os_rhel7_5/modules/autofs/manifests/mount.pp:48; cannot redeclare at /etc/puppet/environments/KT_ITOPS_Sandbox_ccv_os_rhel7_5/modules/autofs/manifests/mount.pp:48 on node louis-vm.
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

Add /net -hosts entry

Please adapt the patch if you want. This way it works for me.

--- mount.pp.bak        2016-03-30 12:29:39.585656336 +0200
+++ mount.pp    2016-03-30 12:39:32.037478746 +0200
@@ -32,18 +32,24 @@
 #
 define autofs::mount (
   $mount,
-  $mapfile,
-  $mapcontents,
+  $mapfile=undef,
+  $mapcontents=undef,
   $options,
   $order,
   $direct=true,
   $execute=false
 ) {

+  if $mapfile {
+    $contents = "${mount} ${mapfile} ${options}\n"
+  } else {
+    $contents = "${mount} ${options}\n"
+  }
+
   concat::fragment { "autofs::fragment preamble ${mount}":
     ensure  => present,
     target  => '/etc/auto.master',
-    content => "${mount} ${mapfile} ${options}\n",
+    content => $contents,
     order   => $order,
   }

@@ -56,13 +62,15 @@
     $maptempl = 'autofs/auto.map.erb'
   }

-  file { $mapfile:
-    ensure  => present,
-    owner   => 'root',
-    group   => 'root',
-    mode    => $mapperms,
-    content => template($maptempl),
-    require => Package[ 'autofs' ],
-    notify  => Service[ 'autofs' ],
+  if $mapfile != undef {
+    file { $mapfile:
+        ensure  => present,
+        owner   => 'root',
+        group   => 'root',
+        mode    => $mapperms,
+        content => template($maptempl),
+        require => Package[ 'autofs' ],
+        notify  => Service[ 'autofs' ],
+      }
   }
 }

Puppetlabs-stdlib version range is too restrictive

Hi,

Firstly, thank you for a great module.
We've got a problem however, in that a few dependencies we use require stdlib > 4.13.0 ... and since this module is pinned to a version <= 4.12.0, we're seeing failed dependency resolution when running librarian-puppet - is there any particular reason that you've pinned to that stdlib release? If it's because of the deprecation warnings, we're seeing the same ... but it's preferable to have the deprecation warnings, and still be able to manage our dependencies cleanly.
Would you consider a pull-request that expands the dependency range?

Thanks in advance

Duplicate declaration: File[/etc/auto.master.d] with use_dir = true

Example hiera yaml

autofs::mounts:
tr01:
mount: '/srv/tr01'
mapfile: '/etc/auto.tr01'
mapcontents:
- 'tr01 -rsize=32768,wsize=32768,noacl test-srv-str-01:/srv/backup/storage'
options: '--timeout=120'
order: 01
use_dir: true
tr02:
mount: '/srv/tr02'
mapfile: '/etc/auto.tr02'
mapcontents:
- 'tr02 -rsize=32768,wsize=32768,noacl test-srv-str-02:/srv/backup/storage'
options: '--timeout=120'
order: 02
use_dir: true

puppet agent -t

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: File[/etc/auto.master.d] is already declared in file /srv/puppet/env/production/modules/autofs/manifests/mount.pp:75; cannot redeclare at /srv/puppet/env/production/modules/autofs/manifests/mount.pp:75 on node ld4-bar-dir-01.int.fxservice.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

Add support for +auto_master

For working with ldap mounts and locally defined mounts, I need to add +auto_master to the end of the auto_master file. I'm not seeing a method to do that. Something like this I thought might work:

autofs::mount { 'auto_master':
mount => '+auto_master',
order => 999,
}

But the mount variable is verifying a valid path, so errors out. I'm thinking an option in the main autofs class? But that class doesn't really deal with the auto_master file.

So I need an auto.master file that looks like this:

/home /etc/auto.home --timeout=120
+auto_master

no newline at the end of /etc/auto.master file, with "use_dir" parameter

automount does not recognize chomped "+dir:/etc/auto.master.d
" entry in /etc/auto.master without a new line at the end.

Debian 8
autofs-5.1.1-1
puppetlabs-concat 2.1.0

puppet agent -t
-+dir:/etc/auto.master.d
++dir:/etc/auto.master.d
\ No newline at end of file

cat /etc/auto.master
+dir:/etc/auto.master.d

ls /etc/auto.master.d/
storage.autofs tr2.autofs

automount -f -d -v
Starting automounter version 5.1.1, master map /etc/auto.master
using kernel protocol version 5.02
lookup_nss_read_master: reading master file /etc/auto.master
parse_init: parse(sun): init gathered global options: (null)
spawn_mount: mtab link detected, passing -n to mount
spawn_umount: mtab link detected, passing -n to mount
no mounts in table

vi /etc/auto.master
add a new line

automount -f -d -v
....
lookup_read_master: lookup(file): read entry /srv/backup
include_file: lookup(dir): include: /etc/auto.master.d/tr2.autofs
lookup_nss_read_master: reading master file /etc/auto.master.d/tr2.autofs
parse_init: parse(sun): init gathered global options: (null)
lookup_read_master: lookup(file): read entry /srv/tr2
master_do_mount: mounting /srv/backup
....

Fix by me
In mount.pp

if !defined(Concat[$master]) {
concat { $master:
owner => 'root',
group => 'root',
mode => '0644',
--> ensure_newline => true, <--
notify => Service[ 'autofs' ],
}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.