Git Product home page Git Product logo

puppet-augeasproviders_mounttab's Introduction

mounttab: additional provider for the mounttab type for Puppet

This module provides an additional provider for the mounttab type using the Augeas configuration library.

The advantage of using Augeas over the default Puppet parsedfile implementations is that Augeas will go to great lengths to preserve file formatting and comments, while also failing safely when needed.

This provider will hide all of the Augeas commands etc., you don't need to know anything about Augeas to make use of it.

Requirements

Ensure both Augeas and ruby-augeas 0.3.0+ bindings are installed and working as normal.

Installing

The module can be installed:

puppet module install puppet/augeasproviders_mounttab

Augeas version compatiblity

Augeas Versions 0.10.0 1.0.0 1.1.0 1.2.0
PROVIDERS
mounttab yes yes yes yes

Documentation and examples

Type documentation can be generated with puppet doc -r type or viewed on the Puppet Forge page.

mounttab provider

This is a provider for a type distributed in the puppetlabs-mount_providers module.

The provider needs to be explicitly given as augeas to use augeasproviders.

If editing a vfstab entry, slightly different options need to be passed compared to a fstab entry.

manage simple fstab entry

mounttab { '/mnt':
  ensure   => present,
  device   => '/dev/myvg/mytest',
  fstype   => 'ext4',
  options  => 'defaults',
  provider => augeas,
}

manage full fstab entry

mounttab { '/mnt':
  ensure   => present,
  device   => '/dev/myvg/mytest',
  fstype   => 'ext4',
  options  => ['nosuid', 'uid=12345'],
  dump     => '1',
  pass     => '2',
  provider => augeas,
}

manage fstab entry with default options

mounttab { '/mnt':
  ensure   => present,
  device   => '/dev/myvg/mytest',
  fstype   => 'ext4',
  provider => augeas,
}

delete fstab entry

mounttab { '/':
  ensure   => absent,
  provider => augeas,
}

manage entry in another fstab location

mounttab { '/home':
  ensure   => present,
  device   => '/dev/myvg/mytest',
  target   => '/etc/anotherfstab',
  provider => augeas,
}

manage device in fstab entry only

mounttab { '/home':
  ensure   => present,
  device   => '/dev/myvg/mytest',
  provider => augeas,
}

Note: dump and pass are both changing unless explicitly specified, see issue #16122.

manage fstype in fstab entry only

mounttab { '/home':
  ensure   => present,
  fstype   => 'btrfs',
  provider => augeas,
}

manage options in fstab entry only

mounttab { '/home':
  ensure   => present,
  options  => 'nosuid',
  provider => augeas,
}

manage complex options in fstab entry only

mounttab { '/home':
  ensure   => present,
  options  => [
    'nosuid',
    'uid=12345',
    'rootcontext='system_u:object_r:tmpfs_t:s0'',
  ],
  provider => augeas,
}

remove options from fstab entry

mounttab { '/home':
  ensure   => present,
  options  => [],
  provider => augeas,
}

manage simple vfstab entry

mounttab { '/mnt':
  ensure   => present,
  device   => '/dev/dsk/c1t1d1s1',
  fstype   => 'ufs',
  atboot   => 'yes',
  provider => augeas,
}

manage full vfstab entry

mounttab { '/mnt':
  ensure      => present,
  device      => '/dev/dsk/c1t1d1s1',
  blockdevice => '/dev/foo/c1t1d1s1',
  fstype      => 'ufs',
  pass        => '2',
  atboot      => 'yes',
  options     => [ 'nosuid', 'nodev' ],
  provider    => augeas,
}

manage vfstab entry with default options

mounttab { '/mnt':
  ensure   => present,
  device   => '/dev/myvg/mytest',
  fstype   => 'ext4',
  provider => augeas,
}

delete vfstab entry

mounttab { '/':
  ensure   => absent,
  provider => augeas,
}

remove options from vfstab entry

mounttab { '/home':
  ensure   => present,
  options  => [],
  provider => augeas,
}

Issues

Please file any issues or suggestions on GitHub.

puppet-augeasproviders_mounttab's People

Contributors

bastelfreak avatar domcleal avatar ekohl avatar h-haaks avatar igalic avatar maxadamo avatar raphink avatar trevor-vaughan avatar zilchms avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

puppet-augeasproviders_mounttab's Issues

Leave dump and pass in tact when modifying an entry

Hello again, sorry for opening 2 issues in one day ๐Ÿ˜„

Suppose I start with this entry in fstab:

/dev/mapper/vg_volgrp01-lv_tmp /tmp                    ext4    defaults        1 2

And all I want to change is the options, I tried the following:

  mounttab { '/tmp':
    ensure   => present,
    options  => ['defaults', 'nodev', 'nosuid', 'noexec'],
    provider => augeas,
  }

However, this changes my pass and dump values too:

Notice: /Stage[main]/Profiles::Base::Compliance::Mounts/Mounttab[/tmp]/options: options changed 'defaults' to 'defaults,nodev,noexec,nosuid'
Notice: /Stage[main]/Profiles::Base::Compliance::Mounts/Mounttab[/tmp]/pass: pass changed '2' to '0'
Notice: /Stage[main]/Profiles::Base::Compliance::Mounts/Mounttab[/tmp]/dump: dump changed '1' to '0'

By comparison, my original augeas version didn't affect these parameters:

  augeas { 'set_tmp_mount_options':
    context => "/files/etc/fstab/*[file='/tmp']",
    changes => [
      "rm opt",
      "insert opt after vfstype",
      "set opt[last()] defaults",
      "insert opt after opt[last()]",
      "set opt[last()] nodev",
      "insert opt after opt[last()]",
      "set opt[last()] nosuid",
      "insert opt after opt[last()]",
      "set opt[last()] noexec",
    ],
  }

Granted it's rather ugly though, hehe ๐Ÿ˜„

Any help on this one would be awesome, and really sorry again for bothering you today

Cheers
Fotis

Usage

Hi

Not an issue but I am having trouble understanding how to use it!

Is there a beginners guide because I am feeling stupid...

I keep getting

Error while evaluating a Function Call, Failed to parse inline template: undefined local variable or method `name' for #Puppet::Parser::TemplateWrapper:0x43e5b812 at /etc/puppetlabs/code/environments/production/modules/mount_providers/manifests/do.pp:13:17 at /etc/puppetlabs/code/environments/production/modules/mount_providers/manifests/init.pp:5 on node

Invalid resource type mounttab

On my puppet master I have execute these commands:

# puppet -V
3.7.4 (Puppet Enterprise 3.7.2)

Then I install the mounttab as per the doc.

# puppet module install herculesteam/augeasproviders_mounttab
Notice: Preparing to install into /etc/puppetlabs/puppet/environments/production/modules ...
Notice: Downloading from https://forgeapi.puppetlabs.com ...
Notice: Installing -- do not interrupt ...
/etc/puppetlabs/puppet/environments/production/modules
โ””โ”€โ”ฌ herculesteam-augeasproviders_mounttab (v2.0.0)
  โ””โ”€โ”ฌ herculesteam-augeasproviders_core (v2.1.2)
    โ””โ”€โ”€ puppetlabs-stdlib (v4.2.1) [/etc/puppetlabs/puppet/modules]
# puppet agent -t
...
# service pe-puppetserver restart
...

I have even rebooted the puppet master. But when I list out my installed puppet classes I do not see mounttab. I have checked like so:

# cat list-classes.sh 
#!/bin/sh

PEFQDN=`hostname -f`
curl -s -X GET -H 'Content-Type: application/json' \
--cert /etc/puppetlabs/puppet/ssl/certs/${PEFQDN}.pem \
--key /etc/puppetlabs/puppet/ssl/private_keys/${PEFQDN}.pem \
--cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem \
https://${PEFQDN}:4433/classifier-api/v1/classes | python -m json.tool
# ./list-classes.sh | grep mounttab

Also if I login into my Puppet Console/dashboard I do not see the class mounttab anywhere.

And if I write a puppet manifest/class like this ...

class my-fstab (
    $spec,
    $mount_point,
    $vfstype,
    $opts,
    $dump = 0,
    $passno = 0,
) { 
    mounttab{ "/data" :
        ensure => present,
        device => $spec,
        fstype => $vfstype,
        options => $opts,
        dump => $dump,
        pass => $passno,
        provider => augeas,
    }
}

... my puppet agent barfs like so:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type mounttab at /etc/puppetlabs/puppet/modules/my-fstab/manifests/init.pp:26 on node mgmt-el7-001.example.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

I am probably doing something wrong and any help is appreciated.

Can't seem to get the provider working with puppet apply

Hey there, really love all these wonderful modules you've created, thank you so much!

I've gotten many of them to work successfully so far (pam, ssh and shellvar), but can't seem to get mounttab to work.

For demonstrational purposes, I'll use a puppet apply with some dummy data just to check if the class is actually found:

Notice how pam is found correctly after installation:

fots@fotsies-dev-server:~$ puppet apply --modulepath=/home/fots/.puppet/modules -e "pam { '': }"
Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type pam at line 1 on node fotsies-dev-server.mydomain.com
Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type pam at line 1 on node fotsies-dev-server.mydomain.com
fots@fotsies-dev-server:~$ puppet module install herculesteam-augeasproviders_pam
Notice: Preparing to install into /home/fots/.puppet/modules ...
Notice: Created target directory /home/fots/.puppet/modules
Notice: Downloading from https://forgeapi.puppetlabs.com ...
Notice: Installing -- do not interrupt ...
/home/fots/.puppet/modules
โ””โ”€โ”ฌ herculesteam-augeasproviders_pam (v2.1.0)
  โ””โ”€โ”ฌ herculesteam-augeasproviders_core (v2.1.1)
    โ””โ”€โ”€ puppetlabs-stdlib (v4.6.0)
fots@fotsies-dev-server:~$ puppet apply --modulepath=/home/fots/.puppet/modules -e "pam { '': }"
Notice: Compiled catalog for fotsies-dev-server.mydomain.com in environment production in 0.04 seconds
Notice: Finished catalog run in 0.01 seconds
Error: Failed to apply catalog: No title provided and "Pam[]" is not a valid resource reference

But mounttab simply won't budge:

fots@fotsies-dev-server:~$ puppet apply --modulepath=/home/fots/.puppet/modules -e "mounttab { '': }"
Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type mounttab at line 1 on node fotsies-dev-server.mydomain.com
Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type mounttab at line 1 on node fotsies-dev-server.mydomain.com
fots@fotsies-dev-server:~$ puppet module install herculesteam-augeasproviders_mounttab
Notice: Preparing to install into /home/fots/.puppet/modules ...
Notice: Downloading from https://forgeapi.puppetlabs.com ...
Notice: Installing -- do not interrupt ...
/home/fots/.puppet/modules
โ””โ”€โ”ฌ herculesteam-augeasproviders_mounttab (v2.0.0)
  โ””โ”€โ”€ herculesteam-augeasproviders_core (v2.1.1)
fots@fotsies-dev-server:~$ puppet apply --modulepath=/home/fots/.puppet/modules -e "mounttab { '': }"
Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type mounttab at line 1 on node fotsies-dev-server.mydomain.com
Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type mounttab at line 1 on node fotsies-dev-server.mydomain.com

This is using Ubuntu 14.04 with 3.6.2 but I've had the same results on RHEL 6.6 with Puppet 3.6.2 (provided via RedHat Satellite).

Specifying the provider makes no difference either I'm afraid.

Any ideas?

Thanks so much!
Fotis

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.