Defined Type: tp::uninstall
- Defined in:
- manifests/uninstall.pp
Overview
This define uninstalls the application (app) defined in title. It may also remove the relevant repository and configuration files.
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 |
# File 'manifests/uninstall.pp', line 29
define tp::uninstall (
Hash $conf_hash = {},
Hash $dir_hash = {},
Hash $settings_hash = {},
Boolean $auto_repo = true,
String[1] $data_module = 'tinydata',
) {
# Settings evaluation
$tp_settings=tp_lookup($title,'settings',$data_module,'deep_merge')
$settings = $tp_settings + $settings_hash
# Automatic repo management
if $auto_repo == true
and ( $settings['repo_url'] or $settings['yum_mirrorlist']) {
tp::repo { $title:
enabled => false,
before => Package[$settings[package_name]],
}
}
# Resources removed
if $settings[package_name] {
ensure_resource( 'package', $settings[package_name], {
'ensure' => 'absent',
})
}
if $settings[service_name] {
ensure_resource( 'service', $settings[service_name], {
'ensure' => 'stopped',
'enable' => false,
})
}
if $conf_hash != {} {
$conf_hash.each |$k,$v| {
tp::conf { $k:
ensure => absent,
}
}
}
if $dir_hash != {} {
$dir_hash.each |$k,$v| {
tp::dir { $k:
ensure => absent,
}
}
}
}
|