diff --git a/REFERENCE.md b/REFERENCE.md
index 340be403f..1e382c4b0 100644
--- a/REFERENCE.md
+++ b/REFERENCE.md
@@ -5476,6 +5476,7 @@ The following parameters are available in the `zabbix::resources::template` defi
* [`delete_missing_graphs`](#-zabbix--resources--template--delete_missing_graphs)
* [`delete_missing_httptests`](#-zabbix--resources--template--delete_missing_httptests)
* [`delete_missing_items`](#-zabbix--resources--template--delete_missing_items)
+* [`delete_missing_linkage`](#-zabbix--resources--template--delete_missing_linkage)
* [`delete_missing_templatescreens`](#-zabbix--resources--template--delete_missing_templatescreens)
* [`delete_missing_triggers`](#-zabbix--resources--template--delete_missing_triggers)
@@ -5551,6 +5552,14 @@ Deletes items from zabbix that are not in the template when set to true
Default value: `false`
+##### `delete_missing_linkage`
+
+Data type: `Boolean`
+
+Delete linked templates when they are no longer present
+
+Default value: `false`
+
##### `delete_missing_templatescreens`
Data type: `Boolean`
@@ -5729,6 +5738,7 @@ The following parameters are available in the `zabbix::template` defined type:
* [`delete_missing_graphs`](#-zabbix--template--delete_missing_graphs)
* [`delete_missing_httptests`](#-zabbix--template--delete_missing_httptests)
* [`delete_missing_items`](#-zabbix--template--delete_missing_items)
+* [`delete_missing_linkage`](#-zabbix--template--delete_missing_linkage)
* [`delete_missing_templatescreens`](#-zabbix--template--delete_missing_templatescreens)
* [`delete_missing_triggers`](#-zabbix--template--delete_missing_triggers)
@@ -5796,6 +5806,14 @@ Deletes items from zabbix that are not in the template when set to true
Default value: `false`
+##### `delete_missing_linkage`
+
+Data type: `Boolean`
+
+Delete linked templates when they are no longer present
+
+Default value: `false`
+
##### `delete_missing_templatescreens`
Data type: `Boolean`
@@ -6193,6 +6211,7 @@ The following parameters are available in the `zabbix_template` type.
* [`delete_missing_graphs`](#-zabbix_template--delete_missing_graphs)
* [`delete_missing_httptests`](#-zabbix_template--delete_missing_httptests)
* [`delete_missing_items`](#-zabbix_template--delete_missing_items)
+* [`delete_missing_linkage`](#-zabbix_template--delete_missing_linkage)
* [`delete_missing_templatescreens`](#-zabbix_template--delete_missing_templatescreens)
* [`delete_missing_triggers`](#-zabbix_template--delete_missing_triggers)
* [`provider`](#-zabbix_template--provider)
@@ -6220,6 +6239,10 @@ Delete web scenarios from zabbix which are not in the template.
Delete items from zabbix which are not in the template.
+##### `delete_missing_linkage`
+
+Delete linked templates when they are no longer present.
+
##### `delete_missing_templatescreens`
Delete templateScreens from zabbix which are not in the template.
diff --git a/lib/puppet/provider/zabbix_template/ruby.rb b/lib/puppet/provider/zabbix_template/ruby.rb
index 2f36b7934..3a0bb5bd1 100644
--- a/lib/puppet/provider/zabbix_template/ruby.rb
+++ b/lib/puppet/provider/zabbix_template/ruby.rb
@@ -51,7 +51,8 @@ def create
updateExisting: true
},
templateLinkage: {
- createMissing: true
+ createMissing: true,
+ deleteMissing: (@resource[:delete_missing_linkage].nil? ? false : @resource[:delete_missing_linkage])
},
templates: {
createMissing: true,
diff --git a/lib/puppet/type/zabbix_template.rb b/lib/puppet/type/zabbix_template.rb
index 8bcb20016..523c9b985 100644
--- a/lib/puppet/type/zabbix_template.rb
+++ b/lib/puppet/type/zabbix_template.rb
@@ -66,6 +66,10 @@ def change_to_s(currentvalue, newvalue)
desc 'Delete items from zabbix which are not in the template.'
end
+ newparam(:delete_missing_linkage, boolean: true) do
+ desc 'Delete linked templates when they are no longer present.'
+ end
+
newparam(:delete_missing_templatescreens, boolean: true) do
desc 'Delete templateScreens from zabbix which are not in the template.'
end
diff --git a/manifests/resources/template.pp b/manifests/resources/template.pp
index ca955df8f..9c095726d 100644
--- a/manifests/resources/template.pp
+++ b/manifests/resources/template.pp
@@ -8,6 +8,7 @@
# @param delete_missing_graphs Deletes graphs from zabbix that are not in the template when set to true
# @param delete_missing_httptests Deletes web-scenarios from zabbix that are not in the template when set to true
# @param delete_missing_items Deletes items from zabbix that are not in the template when set to true
+# @param delete_missing_linkage Delete linked templates when they are no longer present
# @param delete_missing_templatescreens Deletes template-screens from zabbix that are not in the template when set to true
# @param delete_missing_triggers Deletes triggers from zabbix that are not in the template when set to true
define zabbix::resources::template (
@@ -20,6 +21,7 @@
Boolean $delete_missing_graphs = false,
Boolean $delete_missing_httptests = false,
Boolean $delete_missing_items = false,
+ Boolean $delete_missing_linkage = false,
Boolean $delete_missing_templatescreens = false,
Boolean $delete_missing_triggers = false,
) {
@@ -39,6 +41,7 @@
delete_missing_graphs => $delete_missing_graphs,
delete_missing_httptests => $delete_missing_httptests,
delete_missing_items => $delete_missing_items,
+ delete_missing_linkage => $delete_missing_linkage,
delete_missing_templatescreens => $delete_missing_templatescreens,
delete_missing_triggers => $delete_missing_triggers,
}
diff --git a/manifests/template.pp b/manifests/template.pp
index e4b241279..7f81d66cb 100644
--- a/manifests/template.pp
+++ b/manifests/template.pp
@@ -7,6 +7,7 @@
# @param delete_missing_graphs Deletes graphs from zabbix that are not in the template when set to true
# @param delete_missing_httptests Deletes web-scenarios from zabbix that are not in the template when set to true
# @param delete_missing_items Deletes items from zabbix that are not in the template when set to true
+# @param delete_missing_linkage Delete linked templates when they are no longer present
# @param delete_missing_templatescreens Deletes template-screens from zabbix that are not in the template when set to true
# @param delete_missing_triggers Deletes triggers from zabbix that are not in the template when set to true
# @example
@@ -23,6 +24,7 @@
Boolean $delete_missing_graphs = false,
Boolean $delete_missing_httptests = false,
Boolean $delete_missing_items = false,
+ Boolean $delete_missing_linkage = false,
Boolean $delete_missing_templatescreens = false,
Boolean $delete_missing_triggers = false,
) {
@@ -35,6 +37,7 @@
delete_missing_graphs => $delete_missing_graphs,
delete_missing_httptests => $delete_missing_httptests,
delete_missing_items => $delete_missing_items,
+ delete_missing_linkage => $delete_missing_linkage,
delete_missing_templatescreens => $delete_missing_templatescreens,
delete_missing_triggers => $delete_missing_triggers,
}