filepush

A module to push files

Dominic Kaiser

dominickaiser

10,033 downloads

8,103 latest version

1.1 quality score

Version information

  • 0.0.5 (latest)
  • 0.0.4
  • 0.0.3
  • 0.0.2
  • 0.0.1
released Mar 18th 2015
This version is compatible with:
  • RedHat
    ,
    Centos
    ,
    Ubuntu

Start using this module

Documentation

dominickaiser/filepush — version 0.0.5 Mar 18th 2015

This is the filepush module.

This module was created simply to push files. It is fully parameterized to use with Foreman 1.1 and later. I wanted to be able to fill in parameters on the web interface.

License

GPL use it how ever you would like and to your heart's content.

Authors

Demi Benson dbenson.puppet@gmail.com, Dominic Kaiser dominic@theriversouth.org

Code

class ct-filepush (
  $source = undef,
  $target = undef,
  $owner  = undef,
  $group  = $owner,
  $mode   = 0644,
) {
  case $::osfamily {
    'Windows': { fail('Does not yet work wint Windows') }
    default: {
      $path_sep = '/'
      $filepath_ar = split($target, $path_sep)
      $parent_path = join(delete_at($filepath_ar, -1), $path_sep)
      exec { 'make_parent_dirs':
        path    => [ '/usr/bin', '/usr/sbin', '/bin'],
        command => "mkdir -p ${parent_path}",
        unless  => "test -d ${parent_path}"
      }
    }
  }

  file { $target:
    ensure => directory,
    path   => $target,
    mode   => $mode,
    owner  => $owner,
    group  => $group,
    source => $source,
  }
}

This is so I can push a file to a directory and if parent directories do not exist create them. This gives you a blank template to just pop values in and apply.

TODO

  • Need to make it compatible with windows. If anyone knows how to mkdir -p in windows let me know and I will finish adding this.

Support

Please email dominic@theriversouth.org Thank You!