Puppet Class: apt::dater::host

Defined in:
manifests/dater/host.pp

Overview

Class: apt::dater::host



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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'manifests/dater/host.pp', line 3

class apt::dater::host {
  include apt::dater

  case $::operatingsystem {
    /(?i:Debian|Ubuntu|Mint)/: {
      if !defined(Package[$apt::dater::host_package]) {
        package { $apt::dater::host_package:
          ensure => $apt::dater::manage_package,
          noop   => $apt::dater::noops,
        }
      }
    }
    /(?i:RedHat|Centos|Scientific|Fedora)/: {
      file { '/usr/bin/apt-dater-host':
        ensure => 'present',
        owner  => $apt::dater::host_user,
        group  => $apt::dater::host_user,
        mode   => '0750',
        source => 'puppet:///modules/apt/apt-dater-host-yum',
      }
    }
    default: {}
  }

  if !$apt::dater::bool_reuse_host_user {
    user { $apt::dater::host_user:
      ensure     => present,
      system     => true,
      home       => $apt::dater::host_home_dir,
      managehome => true;
    }
  }

  if !$apt::dater::bool_reuse_ssh {
    file { "${apt::dater::host_home_dir}/.ssh":
      ensure => directory,
      mode   => '0700',
      owner  => $apt::dater::host_user;
    }

    ssh_authorized_key { 'apt-dater-key':
      ensure  => $apt::dater::manage_host_user,
      user    => $apt::dater::host_user,
      options => $apt::dater::ssh_key_options,
      type    => $apt::dater::ssh_key_type,
      key     => $apt::dater::ssh_key,
      require => File["${apt::dater::host_home_dir}/.ssh"];
    }
  }

  sudo::directive { 'apt-dater':
    content => "${apt::dater::host_user} ALL=NOPASSWD: ${apt::dater::host_update_cmd}\n";
  }

  @@apt::dater::host_fragment { $::fqdn:
    customer => $apt::dater::customer,
    ssh_user => $apt::dater::host_user,
    ssh_name => $::fqdn,
    ssh_port => $apt::dater::ssh_port;
  }
}