## puppet_cd::puppetdb::dirs.pp
# Module name: puppet_cd
# Author: Arne Teuke (arne_teuke@confdroid)
# @summary  Class manages puppetdb directories
###############################################################################
class puppet_cd::puppetdb::dirs (

) inherits puppet_cd::params {
  if ($fqdn == $pt_puppetdb_server) and ($pt_use_puppetdb == true) {
    require puppet_cd::main::install

    # main directory
    file { $pt_puppetdb_main:
      ensure   => directory,
      path     => $pt_puppetdb_main,
      owner    => $pt_puppetdb_user,
      group    => $pt_puppetdb_user,
      mode     => '0750',
      selrange => s0,
      selrole  => object_r,
      seltype  => etc_t,
      seluser  => system_u,
    }

    # conf.d directory
    file { $pt_puppetdb_conf_d:
      ensure   => directory,
      path     => $pt_puppetdb_conf_d,
      owner    => $pt_puppetdb_user,
      group    => $pt_puppetdb_user,
      mode     => '0750',
      selrange => s0,
      selrole  => object_r,
      seltype  => etc_t,
      seluser  => system_u,
    }

    # ssl directory
    file { $pt_puppetdb_ssl:
      ensure   => directory,
      path     => $pt_puppetdb_ssl,
      owner    => $pt_puppetdb_user,
      group    => $pt_puppetdb_user,
      mode     => '0750',
      selrange => s0,
      selrole  => object_r,
      seltype  => etc_t,
      seluser  => system_u,
    }

    # log dir
    file { $pt_puppetdb_log:
      ensure   => directory,
      path     => $pt_puppetdb_log,
      owner    => $pt_puppetdb_user,
      group    => $pt_puppetdb_user,
      mode     => '0700',
      selrange => s0,
      selrole  => object_r,
      seltype  => var_log_t,
      seluser  => system_u,
    }
  }
}
