Skip to content

Puppet

environment.conf

modulepath = ./modules:site:$basemodulepath
manifest   = ./manifests

Puppetfile

mod 'project0-bareos',
  :git => 'https://github.com/Project0/puppet-bareos.git'
mod 'puppet/unattended_upgrades'
mod 'norisnetwork/syslog_ng'
mod 'puppetlabs/stdlib'
mod 'puppetlabs/concat'
mod 'example42/network'
mod 'fraenki-galera'
mod 'puppetlabs/dsc'
mod 'puppetlabs/apt'
mod 'puppetlabs/ntp'
mod 'puppetlabs/git'
mod 'saz/timezone'
mod 'stm/debconf'
mod 'saz/locales'
mod 'saz/sudo'
mod 'saz/ssh'

hiera.yaml

---

version: 5

defaults:
  datadir: "/etc/puppetlabs/code/environments/%{environment}/hiera"
  data_hash: yaml_data

hierarchy:
  - name: "Puppet Node Globs"
    globs:
      - "nodes/%{trusted.certname}/*.yaml"
  - name: "Puppet Nodes"
    paths:
      - "nodes/%{trusted.certname}.yaml"
  - name: "Puppet Hostgroup Globs"
    globs:
      - "roles/%{hostgroup}/*.yaml"
  - name: "Puppet virtual globs"
    globs:
      - "hosttypes/%{::virtual}/%{::kernel}/*.yaml"
  - name: "Puppet OS"
    paths:
      - "os/%{::operatingsystem}.yaml"
      - "os/%{::operatingsystem}/%{::operatingsystemmajrelease}.yaml"
      - "os/%{::osfamily}/%{::operatingsystemmajrelease}.yaml"
      - "os/%{::osfamily}.yaml"
  - name: "Puppet OS Glob"
    globs:
      - "os/%{::operatingsystem}/common/*.yaml"
  - name: "Puppet Common Glob"
    globs:
      - "common/%{::kernel}/*.yaml"
  - name: "Puppet Common"
    paths:
      - "common.yaml"

manifests/site.pp

lookup('classes',
  'merge' => {
    'strategy'        => 'deep',
    'knockout_prefix' => '=--=' }).include

lookup('resources',
  'merge'         => {
    'strategy'          => 'deep',
    'knockout_prefix'   => '=--=',
    'merge_hash_arrays' => true },
  'default_value' => {}
).each | String $key, Hash $resource | {
  $resource.each | String $name, Hash $res | {
    Resource[$key] { $name: * => $res }
  }
}

Directory structure

├── environment.conf
├── hiera
│   ├── common
│   │   ├── crons.yaml
│   │   ├── htop.yaml
│   │   ├── locale.yaml
│   │   ├── logrotate.yaml
│   │   ├── packages.yaml
│   │   ├── shell.yaml
│   │   ├── ssh.yaml
│   │   ├── time.yaml
│   │   └── updates.yaml
│   ├── nodes
│   │   ├── sd01ve.backup.node.yaml
│   │   ├── sql01vp.backup.node
│   │   │   └── bareos_ssl.yaml
│   │   ├── sql01vp.backup.node.yaml
│   │   ├── sql02vp.backup.node
│   │   │   └── bareos_ssl.yaml
│   │   ├── sql02vp.backup.node.yaml
│   │   ├── sql03vp.backup.node
│   │   │   └── bareos_ssl.yaml
│   │   └── sql03vp.backup.node.yaml
│   ├── os
│   │   ├── Debian
│   │   │   ├── logging.yaml
│   │   │   └── unattendedupgrades.yaml
│   │   ├── Debian.yaml
│   │   ├── RedHat
│   │   │   ├── 6.yaml
│   │   │   └── 7.yaml
│   │   └── RedHat.yaml
│   ├── role
│   │   └
│   │    aptly
│   │    └── aptly.yaml
│   │    bareos
│   │    ├── director
│   │    │   ├── apache.yaml
│   │    │   ├── bareos.yaml
│   │    │   ├── clients.yaml
│   │    │   ├── director.yaml
│   │    │   ├── easyrsa.yaml
│   │    │   ├── filesets.yaml
│   │    │   ├── icinga.yaml
│   │    │   ├── jobs.yaml
│   │    │   ├── messages.yaml
│   │    │   ├── pools.yaml
│   │    │   ├── profiles.yaml
│   │    │   ├── schedules.yaml
│   │    │   ├── ssl.yaml
│   │    │   ├── storages.yaml
│   │    │   └── webui.yaml
│   │    └── storage
│   │        ├── bareos.yaml
│   │        ├── ceph.yaml
│   │        ├── icinga.yaml
│   │        ├── messages.yaml
│   │        ├── ssl.yaml
│   │        └── zfs.yaml
│   │    galera
│   │    ├── bareos
│   │    │   ├── bareos.yaml
│   │    │   └── galera.yaml
│   │    ├── common
│   │    │   └── galera.yaml
[...]
│   └── vmware
│       └── common.yaml
├── hiera.yaml
├── manifests
│   └── site.pp
├── Puppetfile
└── site
    └── profile
        ├── files
        │   ├── bareos_webui_fslist.patch
        │   ├── bash_profile
        ├── manifests
        │   ├── apt.pp
        │   ├── galera.pp
        │   ├── mysql.pp
        │   └── user.pp
        └── templates
            ├── authorized_keys.epp
            ├── bashrc.custom.erb
            [...]

Last update: April 13, 2020

Comments