Puppet module to wget/chmod files.

file, wget, download, chmod, chown
puppet module install gajdaw-filefetcher --version 0.1.6


filefetcher Puppet Module

Table of Contents

  1. Overview
  2. Module Description
  3. Setup
  4. Usage
  5. Reference
  6. Limitations
  7. Development
  8. Inspiration


This module aims to simplify the three actions wget + chown + chmod. It helps you to download the files from the net and set appropriate the owner and access rights.


I prepared it for PHP Phars, like:

  • composer.phar
  • phpunit.phar
  • box.phar
  • php-cs-fixer.phar
  • symfony.phar

But filefetcher is a general tool to perform wget/chown/chmod.

If you are interested in PHARS, please refer to a more specialized puppet-php_phars module.

Module Description

In general:

  • the module downloads a file to an arbitrary directory
  • sets the owner
  • sets the rights

It can be seen as a sequence of three:

  • wget
  • chown
  • chmod



What filefetcher affects


  • downloads a file using URL parameter (e.g.
  • saves it under a given name (e.g. composer) in an arbitrary directory (e.g. /usr/local/bin)
  • sets the owner (e.g. root)
  • sets the rights (e.g. a+x)

Setup Requirements

The module uses:

Beginning with filefetcher

System wide install with Puppet

To install the module in your system run:

sudo puppet module install gajdaw-filefetcher

You may lock the version to avoid using the latest version:

sudo puppet module install gajdaw-filefetcher --version 0.1.0

System wide install with Git

You may also use git to install the module:

mkdir -p /etc/puppet/modules/filefetcher
cd /etc/puppet/modules/filefetcher
git clone --depth 1 .

To lock the version, use:

git clone --depth 1 --branch v0.1.0 .


The examples are stored under examples/ directory.

Symfony Homepage

# Filename: examples/symfony-homepage.pp
filefetcher::fetch { 'Symfony Homepage':
    filename   => 'symfony-homepage',
    target_dir => '/tmp',
    user       => 'vagrant',
    rights     => '644',
    url        => '',
    redownload => true,

To run it use the following command:

sudo puppet apply examples/symfony-standard-composer-json.pp


The complete list of parameters is available in manifests/fetch.pp file.


The module was tested on:

  • Ubuntu
    • 12.04 / Puppet 3.7
    • 14.04 / Puppet 3.7
  • CentOS
    • 6.5 / Puppet 3.7


The best method I have found so far to work on Puppet modules is:

  • keep all modules in a single directory of your host (host/some/dir)
  • create a Vagrant env in the dir that contains all the modules
    ├── puppet-filefetcher
    │   ├── examples
    │   ├── Gemfile
    │   ├── LICENSE
    │   ├── manifests
    │   ├── metadata.json
    │   ├── pkg
    │   ├── Rakefile
    │   ├──
    │   ├── spec
    │   ├── tests
    │   └── tmp
    ├── puppet-php_phars
    │   ├── examples
    │   ├── Gemfile
    │   ├── LICENSE
    │   ├── manifests
    │   ├── metadata.json
    │   ├── Rakefile
    │   ├──
    │   ├── spec
    │   └── tests
    └── Vagrantfile

Then create symbolic links to modules:

sudo ln -s /vagrant/puppet-filefetcher /etc/puppet/modules/filefetcher

Working this way you can test the module without:

  • building
  • installing
  • uploading to the Puppet Forge

The command to check CS:

puppet-lint manifests --no-autoloader_layout-check

The commands to build a module:

rm -rf pkg/
puppet module build

sudo puppet module list
sudo puppet module install gajdaw-filefetcher
sudo puppet module install pkg/gajdaw-filefetcher-0.1.2.tar.gz
sudo puppet module uninstall gajdaw-filefetcher

All the examples:

sudo puppet apply examples/symfony-homepage.pp


The inspiration came from willdurrand-composer authored by William Durand.