# Puppet Class: confdroid_postgresql::main::files

Inherits:
  confdroid_postgresql::params

Defined in:
  manifests/main/files.pp

## Summary

Class manages logic for the confdroid_postgresql module.

## Overview

confdroid_postgresql::main::files.pp Module name: confdroid_postgresql Author: 12ww1160 (12ww1160@confdroid.com)

    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
    64
    65
    66
    67
    68

    # File 'manifests/main/files.pp', line 6

    class confdroid_postgresql::main::files (

    ) inherits confdroid_postgresql::params {
      if $fqdn == $pl_server_fqdn {
        require confdroid_postgresql::server::initdb
        require confdroid_postgresql::main::dirs

        file { '/var/lib/pgsql/data/postgresql.conf':
          ensure   => file,
          owner    => 'postgres',
          group    => 'postgres',
          mode     => '0600',
          selrange => s0,
          selrole  => object_r,
          seltype  => postgresql_db_t,
          seluser  => unconfined_u,
          content  => template('confdroid_postgresql/postgresql.conf.erb'),
          notify   => Service[$pl_service],
        }
        if $pl_ssl_enabled == true {
          # manage tls certs
          ## ca.crt
          file { $pl_ca_crt_file:
            ensure   => file,
            owner    => 'postgres',
            group    => 'postgres',
            mode     => '0400',
            selrange => s0,
            selrole  => object_r,
            seltype  => postgresql_db_t,
            seluser  => unconfined_u,
            content  => template($pl_ca_crt_erb),
            notify   => Service[$pl_service],
          }
          ## server.crt
          file { $pl_server_crt_file:
            ensure   => file,
            owner    => 'postgres',
            group    => 'postgres',
            mode     => '0400',
            selrange => s0,
            selrole  => object_r,
            seltype  => postgresql_db_t,
            seluser  => unconfined_u,
            content  => template($pl_server_crt_erb),
            notify   => Service[$pl_service],
          }
          ## server.key
          file { $pl_server_key_file:
            ensure   => file,
            owner    => 'postgres',
            group    => 'postgres',
            mode     => '0400',
            selrange => s0,
            selrole  => object_r,
            seltype  => postgresql_db_t,
            seluser  => unconfined_u,
            content  => template($pl_server_key_erb),
            notify   => Service[$pl_service],
          }
        }
      }
    }