Puppet most used resources types

Carlos Gómez
devops and cross platform development
1 min readMar 15, 2016

--

In the Puppet manifests each resource has a resource type that describes the system that we want to manage, Puppet comes with resource types for system management, and many plugins are available to add even more. Some of the resources types are:

  • File
  • file { ‘/etc/modules’:
    ensure => file,
    content => “# Managed by Puppet!\n\ndrbd\n”,
    }
  • Package
  • package { ‘haproxy’:
    ensure => present,
    provider => ‘dpkg’,
    source => ‘/opt/packages/haproxy-1.5.1_amd64.dpkg’,
    }
  • Service
  • service { ‘count-logins’:
    provider => ‘base’,
    ensure => ‘running’,
    binary => ‘/usr/local/bin/cnt-logins’,
    start => ‘/usr/local/bin/cnt-logins — daemonize’,
    subscribe => File[‘/usr/local/bin/cnt-logins’],
    }
  • Symbolic links
  • file { ‘/etc/apache2/sites-enabled/001-puppet-lore.org’:
    ensure => ‘link’,
    target => ‘../sites-available/puppet-lore.org’,
    }
  • Group and user
  • group { ‘proxy-admins’:
    ensure => present,
    gid => 4002,
    }
    user { ‘devcfgc’:
    ensure => present,
    uid => 2014,
    home => ‘/home/devcfgc’
    managehome => true, # <- adds -m to useradd
    gid => 1000,
    shell => ‘/bin/zsh’,
    groups => [ ‘proxy-admins’ ],
    }
  • Exec
  • exec { ‘tar cjf /opt/packages/homebrewn-3.2.tar.bz2’:
    cwd => ‘/opt’,
    path => ‘/bin:/usr/bin’,
    creates => ‘/opt/homebrewn-3.2’,
    }
  • Cron
  • cron { ‘clean-files’:
    ensure => present,
    user => ‘root’,
    command => ‘/usr/local/bin/clean-files’,
    minute => ‘1’,
    hour => ‘3’,
    weekday => [ ‘2’, ‘6’ ],
    environment => ‘MAILTO=hello@devcfgc.com’,
    }
  • Mount
  • mount { ‘/media/gluster-data’:
    ensure => ‘mounted’,
    device => ‘gluster01:/data’,
    fstype => ‘glusterfs’,
    options => ‘defaults,_netdev’,
    dump => 0,
    pass => 0,
    }

--

--

Cloud/Software Architect and DevOps learning about #devops, #cloud, #netcore, #microservices and #newtech