-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #37654 - Use custom snippets to apply errata
Refs 2064ec7457b3d41b72c2d48b7df9371f8b09d053 in katello Closes #3157
- Loading branch information
1 parent
7385280
commit 852a5f2
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
guides/common/modules/proc_running-custom-code-while-applying-errata.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
---- |