Puppet Class: artifactory::config

Defined in:
manifests/config.pp

Overview

Class artifactory::config

This class is called from artifactory for service config.



5
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
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
# File 'manifests/config.pp', line 5

class artifactory::config {
  # Install storage.properties if Available
  if(
    $::artifactory::db_url or
    $::artifactory::db_username or
    $::artifactory::db_password or
    $::artifactory::db_type) {

    if ($::artifactory::db_url and
        $::artifactory::db_username and
        $::artifactory::db_password and
        $::artifactory::db_type
        ) {

      file { "${::artifactory::artifactory_home}/etc/.secrets":
        ensure => directory,
        owner  => 'artifactory',
        group  => 'artifactory',
      }

      file { "${::artifactory::artifactory_home}/etc/.secrets/.temp.db.properties":
        ensure  => file,
        content => epp(
          'artifactory/db.properties.epp',
          {
            db_url                         => $::artifactory::db_url,
            db_username                    => $::artifactory::db_username,
            db_password                    => $::artifactory::db_password,
            db_type                        => $::artifactory::db_type,
            binary_provider_type           => $::artifactory::binary_provider_type,
            pool_max_active                => $::artifactory::pool_max_active,
            pool_max_idle                  => $::artifactory::pool_max_idle,
            binary_provider_cache_maxsize  => $::artifactory::binary_provider_cache_maxsize,
            binary_provider_base_data_dir  => $::artifactory::binary_provider_base_data_dir,
            binary_provider_filesystem_dir => $::artifactory::binary_provider_filesystem_dir,
            binary_provider_cache_dir      => $::artifactory::binary_provider_cache_dir,
          }
        ),
        mode    => '0640',
        owner   => 'artifactory',
        group   => 'artifactory',
      }

      file { "${::artifactory::artifactory_home}/etc/storage.properties":
        ensure => link,
        target => "${::artifactory::artifactory_home}/etc/.secrets/.temp.db.properties",
      }

      if ($::artifactory::jdbc_driver_url) {
        $file_name =  regsubst($::artifactory::jdbc_driver_url, '.+\/([^\/]+)$', '\1')

        file { "${::artifactory::artifactory_home}/tomcat/lib/${file_name}":
          source => $::artifactory::jdbc_driver_url,
          mode   => '0775',
          owner  => 'root',
        }
      }
    }
    else {
      warning('Database port, hostname, username, password and type must be all be set, or not set. Install proceeding without DB configuration.')#lint:ignore:140chars
    }
  }

  file { "${::artifactory::artifactory_home}/etc/binarystore.xml":
    ensure  => file,
    content => epp(
      'artifactory/binarystore.xml.epp',
      {
        binary_provider_type           => $::artifactory::binary_provider_type,
        binary_provider_cache_maxsize  => $::artifactory::binary_provider_cache_maxsize,
        binary_provider_base_data_dir  => $::artifactory::binary_provider_base_data_dir,
        binary_provider_filesystem_dir => $::artifactory::binary_provider_filesystem_dir,
        binary_provider_cache_dir      => $::artifactory::binary_provider_cache_dir,
      }
    ),
  }

  if ($::artifactory::master_key) {
    file { "${::artifactory::artifactory_home}/etc/security":
      ensure => directory,
      owner  => 'artifactory',
      group  => 'artifactory',
    }

    file { "${::artifactory::artifactory_home}/etc/security/master.key":
      ensure  => file,
      content => $::artifactory::master_key,
      mode    => '0640',
      owner   => 'artifactory',
      group   => 'artifactory',
    }
  }

  if ($::artifactory::db_automate) and ($::artifactory::db_type == 'mysql') {
    include systemd::systemctl::daemon_reload
    include ::artifactory::mysql

    file { 'artif_service':
      ensure => present,
      path   => '/lib/systemd/system/artifactory.service',
      source => 'puppet:///modules/artifactory/artifactory.service',
      mode   => '0755',
    }
    file_line { 'limits':
      ensure => present,
      path   => '/etc/security/limits.conf',
      line   => "artifactory soft nofile 32000 \n artifactory hard nofile 32000",
    }
    file { 'artifManage':
      ensure => present,
      path   => '/opt/jfrog/artifactory/bin/artifactoryManage.sh',
      source => 'puppet:///modules/artifactory/artifactoryManage.sh',
      mode   => '0775',
    }
    ~> Class['systemd::systemctl::daemon_reload']
    contain ::mysql::server
  }
}