dhollinger / autofs-puppet Goto Github PK
View Code? Open in Web Editor NEWPuppet Module to install and manage autofs
License: Other
Puppet Module to install and manage autofs
License: Other
Add puppet strings for version 2.0.0
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?
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:
#file { $mount:
#}
file { $mapfile:
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
content => template('autofs/auto.map.erb'),
notify => Service[ 'autofs' ],
}
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.
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
# 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.
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
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.
Update the README to add/remove any relevant information for the new release.
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
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' ],
+ }
}
}
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
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
It fails due to there being no package selection for SUSE. Once the package code is in place the module works.
Update Documentation and metadata.json for 1.3.0 release.
Add support for Solaris Autofs
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
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 filecat /etc/auto.master
+dir:/etc/auto.master.dls /etc/auto.master.d/
storage.autofs tr2.autofsautomount -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 tablevi /etc/auto.master
add a new lineautomount -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' ],
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.