File: swiftstore.pp

package info (click to toggle)
openstack-cluster-installer 21
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,212 kB
  • sloc: php: 9,235; sh: 2,936; makefile: 14
file content (118 lines) | stat: -rw-r--r-- 3,400 bytes parent folder | download
1
2
3
4
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
class oci::swiftstore(
  $machine_hostname          = undef,
  $machine_ip                = undef,
  $network_ipaddr            = undef,
  $network_cidr              = undef,
  $block_devices             = undef,
  $statsd_hostname           = undef,
  $pass_swift_hashpathsuffix = undef,
  $pass_swift_hashpathprefix = undef,
  $zoneid                    = undef,
  $use_ssl                   = true,
){

  package { 'rsyslog':
    ensure => present,
  }
  service { 'rsyslog':
    ensure  => running,
    enable  => true,
    require => Package['rsyslog'],
  }

  file { '/var/log/swift':
    ensure => directory,
    mode   => '0750',
  }

  file { '/etc/rsyslog.d/10-swift.conf':
    ensure  => present,
    source  => "puppet:///modules/${module_name}/rsyslog-swift.conf",
    require => [Package['rsyslog'], File['/var/log/swift']],
    notify  => Service['rsyslog'],
  }

  File<| title == '/var/log/swift' |> {
    owner => 'swift',
    group => 'adm'
  }

  class { '::memcached':
    listen_ip => '127.0.0.1',
    udp_port  => 0,
  }

  class { 'swift':
    swift_hash_path_suffix => $pass_swift_hashpathsuffix,
    swift_hash_path_prefix => $pass_swift_hashpathprefix,
  }

  class { '::swift::storage':
    storage_local_net_ip => $machine_ip,
  }
  include swift::storage::container
  include swift::storage::account
  include swift::storage::object

  if $statsd_hostname == ''{
    $statsd_enabled = false
  } else {
    $statsd_enabled = true
  }

  swift::storage::server { '6002':
    type                 => 'account',
    devices              => '/srv/node',
    config_file_path     => 'account-server.conf',
    storage_local_net_ip => "${machine_ip}",
    pipeline             => ['healthcheck', 'recon', 'account-server'],
    statsd_enabled           => $statsd_enabled,
    log_statsd_host          => $statsd_hostname,
    log_statsd_metric_prefix => $machine_hostname,
  }

  swift::storage::server { '6001':
    type                 => 'container',
    devices              => '/srv/node',
    config_file_path     => 'container-server.conf',
    storage_local_net_ip => "${machine_ip}",
    pipeline             => ['healthcheck', 'recon', 'container-server'],
    statsd_enabled           => $statsd_enabled,
    log_statsd_host          => $statsd_hostname,
    log_statsd_metric_prefix => $machine_hostname,
  }

  swift::storage::server { '6200':
    type                   => 'object',
    devices                => '/srv/node',
    config_file_path       => 'object-server.conf',
    storage_local_net_ip   => "${machine_ip}",
    pipeline               => ['healthcheck', 'recon', 'object-server'],
    servers_per_port       => 1,
    replicator_concurrency => 10,
    statsd_enabled           => $statsd_enabled,
    log_statsd_host          => $statsd_hostname,
    log_statsd_metric_prefix => $machine_hostname,
  }

  $block_devices.each |Integer $index, String $value| {
    swift::storage::disk { "${value}":
       mount_type  => 'uuid',
      require => Class['swift'],
    }->
    exec { "fix-unix-right-of-${value}":
      path    => "/bin",
      command => "chown swift:swift /srv/node/${value}",
      unless  => "cat /proc/mounts | grep -E ^/dev/${value}",
    }
  }

  $rings = [
    'account',
    'object',
    'container']
  swift::storage::filter::recon { $rings: }
  swift::storage::filter::healthcheck { $rings: }

  Swift::Ringsync<<||>>
}