Defined Type: openiosds::oioswift

Defined in:
manifests/oioswift.pp

Overview

Configure and install an OpenIO oioswift service

Parameters:

  • action (Any) (defaults to: 'create')
  • type (Any) (defaults to: 'oioswift')
  • num (Any) (defaults to: '0')
  • ns (Any) (defaults to: undef)
  • ipaddress (Any) (defaults to: $::ipaddress)
  • port (Any) (defaults to: $::openiosds::params::oioswift_port)
  • workers (Any) (defaults to: '2')
  • sds_proxy_url (Any) (defaults to: "http://${::openiosds::params::oioproxy_url}")
  • object_post_as_copy (Any) (defaults to: false)
  • memcache_servers (Any) (defaults to: "${ipaddress}:11211")
  • auth_uri (Any) (defaults to: "http://${ipaddress}:5000/v2.0")
  • auth_protocol (Any) (defaults to: 'http')
  • auth_host (Any) (defaults to: $::ipaddress)
  • auth_port (Any) (defaults to: '35357')
  • identity_uri (Any) (defaults to: "http://${ipaddress}:35357")
  • admin_tenant_name (Any) (defaults to: 'services')
  • admin_user (Any) (defaults to: 'swift')
  • admin_password (Any) (defaults to: 'SWIFT_PASS')
  • delay_auth_decision (Any) (defaults to: true)
  • operator_roles (Any) (defaults to: 'admin,_member_')
  • no_exec (Any) (defaults to: false)


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

define openiosds::oioswift (
  $action              = 'create',
  $type                = 'oioswift',
  $num                 = '0',

  $ns                  = undef,
  $ipaddress           = $::ipaddress,
  $port                = $::openiosds::params::oioswift_port,
  $workers             = '2',
  $sds_proxy_url       = "http://${::openiosds::params::oioproxy_url}",
  $object_post_as_copy = false,
  $memcache_servers    = "${ipaddress}:11211",
  $auth_uri            = "http://${ipaddress}:5000/v2.0",
  $auth_protocol       = 'http',
  $auth_host           = $::ipaddress,
  $auth_port           = '35357',
  $identity_uri        = "http://${ipaddress}:35357",
  $admin_tenant_name   = 'services',
  $admin_user          = 'swift',
  $admin_password      = 'SWIFT_PASS',
  $delay_auth_decision = true,
  $operator_roles      = 'admin,_member_',

  $no_exec             = false,
) {

  if ! defined(Class['openiosds']) {
    include openiosds
  }

  # Validation
  $actions = ['create','remove']
  validate_re($action,$actions,"${action} is invalid.")
  validate_string($type)
  validate_integer($num)
  validate_string($ns)
  if ! has_interface_with('ipaddress',$ipaddress) { fail("${ipaddress} is invalid.") }
  validate_integer($port)
  validate_integer($workers)
  validate_string($sds_proxy_url)
  validate_bool($object_post_as_copy)
  validate_string($memcache_servers)
  validate_string($auth_uri)
  validate_string($auth_protocol)
  validate_string($auth_host)
  validate_integer($auth_port)
  validate_string($identity_uri)
  validate_string($admin_tenant_name)
  validate_string($admin_user)
  validate_string($admin_password)
  validate_bool($delay_auth_decision)
  validate_string($operator_roles)


  # Namespace
  if $action == 'create' {
    if ! defined(Openiosds::Namespace[$ns]) {
      fail('You must include the namespace class before using OpenIO defined types.')
    }
  }

  # Packages
  if $::os['family'] == 'RedHat' {
    if ! defined(Package['rdo-release']) {
      ensure_resource('package', 'rdo-release', {
        source   => $::openiosds::params::package_rdo_release,
        provider => 'rpm',
        ensure   => present,
        before   => Package[$::openiosds::params::package_swift_proxy],
      })
    }
  }
  if ! defined(Package[$::openiosds::params::package_swift_proxy]) {
    if $::openiosds::params::package_swift_dep { ensure_packages($::openiosds::params::package_swift_dep,$::openiosds::params::package_swift_dep_opt) }
    ensure_resource('package', $::openiosds::params::package_swift_proxy, {
      ensure  => present,
      before  => Package['openio-sds-swift'],
    })
  }
  ensure_packages('openio-sds-swift',$::openiosds::params::package_install_options)
  # Service
  openiosds::service {"${ns}-${type}-${num}":
    action => $action,
    type   => $type,
    num    => $num,
    ns     => $ns,
  } ->
  # Configuration files
  file { '/etc/swift/swift.conf':
    mode => '0644',
  } ->
  file { "${openiosds::sysconfdir}/${ns}/${type}-${num}/proxy-server.conf":
    ensure  => $openiosds::file_ensure,
    content => template("openiosds/${type}-proxy-server.conf.erb"),
    mode    => $openiosds::file_mode,
  } ->
  # Init
  gridinit::program { "${ns}-${type}-${num}":
    action  => $action,
    command => "${openiosds::bindir}/swift-proxy-server  ${openiosds::sysconfdir}/${ns}/${type}-${num}/proxy-server.conf",
    group   => "${ns},${type},${type}-${num}",
    uid     => $openiosds::user,
    gid     => $openiosds::group,
    no_exec => $no_exec,
  }

}