diff --git a/guides/common/assembly_managing-errata.adoc b/guides/common/assembly_managing-errata.adoc index 11502325727..20556fa3cb3 100644 --- a/guides/common/assembly_managing-errata.adoc +++ b/guides/common/assembly_managing-errata.adoc @@ -8,6 +8,8 @@ include::modules/ref_parameters-available-for-errata-search.adoc[leveloffset=+1] include::modules/proc_applying-installable-errata.adoc[leveloffset=+1] +include::modules/proc_running-custom-code-while-applying-errata.adoc[leveloffset=+1] + include::modules/con_subscribing-to-errata-notifications.adoc[leveloffset=+1] :package-manager: dnf diff --git a/guides/common/modules/proc_running-custom-code-while-applying-errata.adoc b/guides/common/modules/proc_running-custom-code-while-applying-errata.adoc new file mode 100644 index 00000000000..d7a112fec4d --- /dev/null +++ b/guides/common/modules/proc_running-custom-code-while-applying-errata.adoc @@ -0,0 +1,37 @@ +[id="running-custom-code-while-applying-errata_{context}"] += Running custom code while applying errata + +You can use custom snippets to run code before and/or after applying errata on hosts. + +.Prerequisites +* Check your provisioning template to ensure that it supports the custom snippets you want to use. ++ +You can view all job templates that are in use under *Administer* > *Remote Execution Features*. + +.Procedure +. In the {ProjectWebUI}, navigate to *Hosts* > *Templates* > *Job Templates*. +. Click *Create Template*. +. In the *Name* field, enter a name for your custom snippet. +The name must start with the name of a template that supports custom snippets: +** Append `custom pre` to the name of a template to run code before applying errata on hosts. +** Append `custom post` to the name of a template to run code after applying errata on hosts. + ++ +If your template is called `Install Errata - Katello Ansible Default`, name your template `Install Errata - Katello Ansible Default custom pre` or `Install Errata - Katello Ansible Default custom post`. +. On the *Type* tab, select *Snippet*. +. Click *Submit* to create your custom snippet. + +[id="cli-running-custom-code-while-applying-errata_{context}"] +.CLI procedure +. Create a plain text file that contains your custom snippet. +. Create the template using `hammer`: ++ +[options="nowrap" subs="+quotes"] +---- +# hammer template create \ +--file "~/_My_Snippet_" \ +--locations "_My_Location_" \ +--name "_My_Template_Name_custom_pre" \ +--organizations "_My_Organization_" \ +--type snippet +----