Puppet Class: pureftpd

Defined in:
manifests/init.pp

Overview

Class: pureftpd

This class installs, configures, and enables the pure-ftpd package

Parameters

use_selinux

Boolean. Manages whether or not to enable the selinux extensions.

Optional, defaults to false.

config

A hash of configuration file options to be created in ‘pure-ftpd.conf`.

Optional, defaults to ‘{}`.

config_ldap

A hash of configuration file options to be created in ‘pureftpd-ldap.conf`.

Optional, defaults to ‘{}`.

config_mysql

A hash of configuration file options to be created in ‘pureftpd-mysql.conf`.

Optional, defaults to ‘{}`.

config_pgsql

A hash of configuration file options to be created in ‘pureftpd-pgsql.conf`.

Optional, defaults to ‘{}`.

Examples

class { 'pureftpd':
  use_selinux => true,
  config      => {
    ipv4only         => 'Yes',
    passiveportrange => '49999:59999',
  },
}

Parameters:

  • use_selinux (Any) (defaults to: false)
  • config (Any) (defaults to: {})
  • config_ldap (Any) (defaults to: {})
  • config_mysql (Any) (defaults to: {})
  • config_pgsql (Any) (defaults to: {})


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'manifests/init.pp', line 43

class pureftpd (
  $use_selinux  = false,
  $config       = {},
  $config_ldap  = {},
  $config_mysql = {},
  $config_pgsql = {},
) {
  validate_bool($use_selinux)
  validate_hash($config)
  validate_hash($config_ldap)
  validate_hash($config_mysql)
  validate_hash($config_pgsql)

  include pureftpd::service

  class{ 'pureftpd::install': use_selinux => $use_selinux }

  if ! empty($config_ldap) {
    # insert the path to the ldap conf file into pure-ftpd.conf
    $enable_ldap = { ldapconfigfile => $pureftpd::params::ldap_conf_path }

    # instantiate a pureftpd::config::ldap that will notify the service class
    $safe_config_ldap = merge($config_ldap,
      { notify => Class[ 'pureftpd::service' ] }
    )
    create_resources( 'class',
      { 'pureftpd::config::ldap' => $safe_config_ldap }
    )

    # only try to create the ldap configuration file after the pureftpd package
    # is installed and configuration; otherwise the dir may not exist yet
    Class[ 'pureftpd::config' ] ->
    Class[ 'pureftpd::config::ldap' ]
  }

  if ! empty($config_mysql) {
    # insert the path to the mysql conf file into pure-ftpd.conf
    $enable_mysql = { mysqlconfigfile => $pureftpd::params::mysql_conf_path }

    # instantiate a pureftpd::config::mysql that will notify the service class
    $safe_config_mysql = merge($config_mysql,
      { notify => Class[ 'pureftpd::service' ] }
    )
    create_resources( 'class',
      { 'pureftpd::config::mysql' => $safe_config_mysql }
    )

    # only try to create the mysql configuration file after the pureftpd package
    # is installed and configuration; otherwise the dir may not exist yet
    Class[ 'pureftpd::config' ] ->
    Class[ 'pureftpd::config::mysql' ]
  }

  if ! empty($config_pgsql) {
    # insert the path to the pgsql conf file into pure-ftpd.conf
    $enable_pgsql = { pgsqlconfigfile => $pureftpd::params::pgsql_conf_path }

    # instantiate a pureftpd::config::mysql will notify the service class
    $safe_config_pgsql = merge($config_pgsql,
      { notify => Class[ 'pureftpd::service' ] }
    )
    create_resources( 'class',
      { 'pureftpd::config::pgsql' => $safe_config_pgsql }
    )

    # only try to create the pgsql configuration file after the pureftpd
    # package is installed and configuration; otherwise the dir may not exist
    # yet
    Class[ 'pureftpd::config' ] ->
    Class[ 'pureftpd::config::pgsql' ]
  }

  $safe_config = merge(
    $config,
    { notify => Class[ 'pureftpd::service' ] },
    $enable_ldap,
    $enable_mysql,
    $enable_pgsql
  )

  create_resources( 'class', { 'pureftpd::config' => $safe_config } )

  Class[ 'pureftpd::install' ] ->
  Class[ 'pureftpd::config' ] ->
  Class[ 'pureftpd::service' ] ->
  Class[ 'pureftpd' ]
}