GithubHelp home page GithubHelp logo

mlosapio / puppet-files Goto Github PK

View Code? Open in Web Editor NEW

This project forked from scalecommerce/puppet-files

0.0 0.0 0.0 11 KB

Puppet module for managing file-resources in hiera

Ruby 69.78% Puppet 30.22%

puppet-files's Introduction

files

Table of Contents

  1. Overview
  2. Module Description - What the module does and why it is useful
  3. Setup - What you need to do before using this module
  4. Hiera Variables - What you need to configure in hiera
  5. Usage - Configuration options and additional functionality

Overview

Manage Puppet file-resources in hiera.

Module Description

This is a wrapper module to manage puppet file-resources in hiera.

Setup

This module also abstracts templates and static files features. In order to use this you need to symlink files and templates in the module directory to a path or repository containing your files and templates.

cd /etc/puppet/modules/files
ln -s /path/to/yourdata/files
ln -s /path/to/yourdata/templates

Hiera Variables

files Hash of file resources, see Puppet File Reference for documentation of params.

files::templates Configure which template should be used for a file, see Usage for examples.

files::template_vars You can use these variables in your templates like <%= @template_vars['my_var'] %>. These variables are global for all templates, you might want to prefix their names somehow.

Usage

Write a simple file:

files:
  /tmp/test.txt:
    content: foo

Multiline example:

files:
  /tmp/multi.txt:
    content: |+
             This is a
             file with a
             lot of lines.

Hiera variables in content, see documentation for hiera lookup functions:

host_ip: 192.168.1.1

files:
  /tmp/test.txt:
    content: My ip is %{hiera('host_ip')}

Create a recursive directory structure:

files:
  ['/tmp/test/', '/tmp/test/sub/', '/tmp/test/sub/bar/']:
    ensure: directory

Copy a file from this or any other module's file path:

files:
  /tmp/foo.bar:
    source: puppet:///modules/files/foo.bar
  /tmp/my.file
    source: puppet:///modules/<other module name>/my.file
  /tmp/local.txt
    source: /my/path/local.txt

To create a file from this or any other module's template path, you need to declare at least an empty file resource and then assign a template to the title of the file resource. Optionally use template variables:

files:
  /tmp/moo.bar:
    owner: www-data
  /tmp/vhost.conf: {}

files::templates:
  /tmp/moo.bar: files/moo.bar.erb
  /tmp/vhost.conf: <other module name>/vhost.erb

files::template_vars:
  my_var: Hello World.

puppet-files's People

Contributors

thomaslohner avatar adriankirchner avatar

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.