util

My Standard Library for Puppet Modules

Leonardo Thibes

leonardothibes

11,217 downloads

11,072 latest version

2.0 quality score

Version information

  • 1.1.0 (latest)
  • 1.0.0
released Mar 20th 2014

Start using this module

Documentation

leonardothibes/util — version 1.1.0 Mar 20th 2014

puppet-util

My Standard Library for Puppet Modules.

This module provides a "standard library" of resources for developing Puppet Modules. This modules will include the following additions to Puppet:

  • chmod
  • chown
  • compress
  • extract

Functions

chmod

Change the permission of file or directory.

Examples:

util::chmod {'Changing permission for some file':
    file => '/some/file.txt',
    mode => 0644,
}
util::chmod {'Changing permission for some directory':
    file => '/root',
    mode => 0700,
}
util::chmod {'Changing permission for some directory recursively':
    file      => '/root',
    mode      => 0700,
    recursive => true, # default is "false"
}

chown

Change the owner of file or directory.

Examples:

util::chown {'Changing owner for some file':
    file => '/root/file.txt',
    user => 'root',
}
util::chown {'Changing owner for some directory':
    file  => '/srv',
    user  => 'root',
    group => 'admin',
}
util::chown {'Changing owner for some directory recursively':
    file      => '/root',
    user      => 'root',
    group     => 'admin',
    recursive => true,
}

compress

Compres an file or directory.

The type of compression is determined for the file extension.

Examples of compressing files:

util::compress {'Compressing some file with zip utility':
    from => '/tmp/vagrant-shell',
    to   => '/tmp/vagrant-shell.zip',
}
util::compress {'Compressing some file with gzip utility':
    from => '/tmp/vagrant-shell',
    to   => '/tmp/vagrant-shell.gz',
}
util::compress {'Compressing some file with bzip2 utility':
    from => '/tmp/vagrant-shell',
    to   => '/tmp/vagrant-shell.bz2',
}

Examples of compressing directories:

util::compress {'Compressing some directory with zip utility':
    from => '/etc/vim',
    to   => '/root/vim.zip',
}
util::compress {'Compressing some directory with gzip utility':
    from => '/etc/vim',
    to   => '/root/vim.tar.gz',
}
util::compress {'Compressing some directory with bzip2 utility':
    from => '/etc/vim',
    to   => '/root/vim.tar.bz2',
}

extract

Extract an compressed file.

The type of extraction is determined for the file extension.

Examples of extracting files:

util::extract {'extracting some file with zip utility':
    from => '/tmp/vagrant-shell.zip',
    to   => '/root',
}
util::extract {'extracting some file with gzip utility':
    from => '/tmp/vagrant-shell.gz',
    to   => '/root',
}
util::extract {'extracting some file with bzip2 utility':
    from => '/tmp/vagrant-shell.bz2',
    to   => '/root',
}

Examples of extracting directories:

util::extract {'Extracting some directory with zip utility':
    from => '/root/vim.zip',
    to   => '/tmp',
}
util::extract {'Extracting some directory with gzip utility':
    from => '/root/vim.tar.gz',
    to   => '/tmp',
}
util::extract {'Extracting some directory with bzip2 utility':
    from => '/root/vim.tar.bz2',
    to   => '/tmp',
}

Contact

Principal developer: Leonardo Thibes => eu@leonardothibes.com

Support

Please log tickets and issues at our Projects site