File: tuned.pp

package info (click to toggle)
openstack-cluster-installer 43.0.22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,544 kB
  • sloc: php: 19,169; sh: 18,137; ruby: 75; makefile: 31; xml: 8
file content (55 lines) | stat: -rw-r--r-- 1,553 bytes parent folder | download | duplicates (4)
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
# Install tuned and provision a given profile
class oci::tuned (
  $profile = undef,
){
  package { 'tuned': ensure => 'present' }

  if $::service_provider == 'systemd' {
    file { '/etc/systemd/system/tuned.service.d':
      ensure => 'directory',
      owner  => 'root',
      group  => 'root',
      mode   => '0755',
    }
    file { '/etc/systemd/system/tuned.service.d/before.conf':
      owner   => 'root',
      group   => 'root',
      mode    => '0644',
      content => "[Unit]\nBefore=openvswitch-switch.service mysql.service nova-compute.service neutron-openvswitch-agent.service neutron-l3-agent.service haproxy.service\n",
    }
    ~> exec { 'tuned systemctl daemon-reload':
      command     => 'systemctl daemon-reload',
      path        => $::path,
      refreshonly => true,
      before      => Service['tuned'],
    }
  }
  # Enable the service
  service { 'tuned':
    ensure    => 'running',
    enable    => true,
    hasstatus => true,
    require   => Package['tuned'],
  }
  if $profile {
    $profile_real = $profile
  }else{
    $profile_real = 'throughput-performance'
  }

  # Enable the chosen profile
  exec { "tuned-adm profile ${profile_real}":
    unless  => "/bin/true # comment to satisfy puppet syntax requirements
set -e
set -x
if [ \"${profile_real}\" = ''\$(tuned-adm active | sed 's/Current active profile: //') ] ; then
    exit 0
else
    exit 1
fi",
    require => Service['tuned'],
    path    => [ '/sbin', '/bin', '/usr/sbin' ],
    # No need to notify services, tuned-adm restarts them alone
  }

}