summaryrefslogtreecommitdiff
path: root/puppet/modules/site_config/manifests/remove/tapicero.pp
blob: 4ce972d0ba230fa70967df9840cbf64417d89be1 (plain)
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
# remove tapicero leftovers from previous deploys on couchdb nodes
class site_config::remove::tapicero {

  # remove tapicero couchdb user
  $couchdb_config = hiera('couch')
  $couchdb_mode   = $couchdb_config['mode']

  if $couchdb_mode == 'multimaster'
  {
    $port = 5986
  } else {
    $port = 5984
  }

  exec { 'remove_couchdb_user':
    onlyif  => "/usr/bin/curl -s 127.0.0.1:${port}/_users/org.couchdb.user:tapicero | grep -qv 'not_found'",
    command => "/usr/local/bin/couch-doc-update --host 127.0.0.1:${port} --db _users --id org.couchdb.user:tapicero --delete"
  }


  exec { 'kill_tapicero':
    onlyif  => '/usr/bin/test -s /var/run/tapicero.pid',
    command => '/usr/bin/pkill --pidfile /var/run/tapicero.pid'
  }

  user { 'tapicero':
    ensure  => absent;
  }

  group { 'tapicero':
    ensure => absent,
    require => User['tapicero'];
  }

  tidy {
    '/srv/leap/tapicero':
      recurse => true,
      require   => [ Exec['kill_tapicero'] ];
    '/var/lib/leap/tapicero':
      require   => [ Exec['kill_tapicero'] ];
    '/var/run/tapicero':
      require   => [ Exec['kill_tapicero'] ];
    '/etc/leap/tapicero.yaml':
      require   => [ Exec['kill_tapicero'] ];
    '/etc/init.d/tapicero':
      require   => [ Exec['kill_tapicero'] ];
    'tapicero_logs':
      path    => '/var/log/leap',
      recurse => true,
      matches => 'tapicero*',
      require   => [ Exec['kill_tapicero'] ];
    '/etc/check_mk/logwatch.d/tapicero.cfg':;
  }

  # remove local nagios plugin checks via mrpe
  augeas {
    'Tapicero_Procs':
      incl    => '/etc/check_mk/mrpe.cfg',
      lens    => 'Spacevars.lns',
      changes => 'rm /files/etc/check_mk/mrpe.cfg/Tapicero_Procs',
      require => File['/etc/check_mk/mrpe.cfg'];
    'Tapicero_Heartbeat':
      incl    => '/etc/check_mk/mrpe.cfg',
      lens    => 'Spacevars.lns',
      changes => 'rm Tapicero_Heartbeat',
      require => File['/etc/check_mk/mrpe.cfg'];
  }

}