Puppet Class: archvsync::runmirrors

Defined in:
manifests/runmirrors.pp

Overview

Parameters:

  • homedir (Any) (defaults to: '/home/ftp')
  • runmirrors_mailto (Any) (defaults to: undef)
  • runmirrors_ssh_key_file (Any) (defaults to: '.ssh/id_rsa')
  • runmirrors_logdir (Any) (defaults to: undef)
  • runmirrors_hostnames (Any) (defaults to: [])


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'manifests/runmirrors.pp', line 1

class archvsync::runmirrors (
  $homedir                 = '/home/ftp',
  $runmirrors_mailto       = undef,
  $runmirrors_ssh_key_file = '.ssh/id_rsa',
  $runmirrors_logdir       = undef,
  $runmirrors_hostnames   = [],
){

  $runmirrors_ssh_key_path = "${homedir}/${runmirrors_ssh_key_file}"

  file { "${homedir}/.config/ftpsync/runmirrors.conf":
    ensure                  => file,
    owner                   => ftp,
    mode                    => '0644',
    selinux_ignore_defaults => true,
    content                 => template("${module_name}/runmirrors.conf.erb"),
  }

# This will produce something like this:
# all hostname-a.ch ssh+ftpsync://ftp@hostname-a.ch
# all hostname-b.ch ssh+ftpsync://ftp@hostname-b.ch

  $runmirrors_template = '<%- if @runmirrors_hostnames and @runmirrors_hostnames != "" -%>
<%-   Array(@runmirrors_hostnames).each do |runmirrors_hostname| -%>
staged <%= runmirrors_hostname %> <%= runmirrors_hostname %> ftp 2
<%-   end -%>
<%- end -%>'

  file { "${homedir}/.config/ftpsync/runmirrors.mirror":
    owner                   => 'ftp',
    group                   => 'ftp',
    content                 => inline_template($runmirrors_template),
    selinux_ignore_defaults => true,
    mode                    => '0644',
  }

}