external help file | Module Name | online version | schema |
---|---|---|---|
Jagabata.psm.dll-Help.xml |
Jagabata.psm |
2.0.0 |
Retrieve job logs.
Get-AnsibleJobLog [-Type] <ResourceType> [-Id] <UInt64> [-Format <JobLogFormat>] [-Dark] [<CommonParameters>]
Get-AnsibleJobLog [-Type] <ResourceType> [-Id] <UInt64> -Download <DirectoryInfo> [-Format <JobLogFormat>]
[-Dark] [<CommonParameters>]
Get-AnsibleJobLog [-Job] <IResource> [-Format <JobLogFormat>] [-Dark] [<CommonParameters>]
Get-AnsibleJobLog [-Job] <IResource> -Download <DirectoryInfo> [-Format <JobLogFormat>] [-Dark]
[<CommonParameters>]
Retrieve job logs for UnifiedJob(s) and output to STDOUT or download to files for each jobs. The job's information is added to the file when downloading.
You can choose log format with -Format
parameter:
txt
: Plain text (default)ansi
: Plain text with ANSI color (need Terminal supported VT100 escape sequence)html
: HTML formatjson
: JSON format (only affected when downloding. otherwise same asansi
)
"UnifiedJob(s)" referes to following jobs:
Job
: JobTempalte's jobProjectUpdate
: Project's update jobInventoryUpdate
: InventorySource's update jobAdHocCommand
: AdHocCommand's jobWorkflowJob
: WorkflowJobTemplate's jobSystemJob
: SystemJobTemplate's job
When the specified job is a WorkflowJob, retrieve job logs for each of its nodes.
Implements following Rest API:
/api/v2/jobs/{id}/stdout/
/api/v2/project_updates/{id}/stdout/
/api/v2/inventory_updates/{id}/stdout/
/api/v2/ad_hoc_commands/{id}/stdout/
PS C:\> Get-AnsibleJobLog @{ type = "job"; id = 10 }
==> [10] Job
PLAY [Hello World Sample] ******************************************************
TASK [Gathering Facts] *********************************************************
ok: [localhost]
TASK [Hello Message] ***********************************************************
ok: [localhost] => {
"msg": "Hello World!"
}
PLAY RECAP *********************************************************************
localhost : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Show the log for Job of ID 10 as text format.
PS C:\> Get-AnsibleJobLog @{ type = job; id = 10 } -Format html -Download .
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 2024/08/05 14:20 4081 10.html
Download log to the current directory as HTML format.
PS C:\> Find-AnsibleJob -Status successful,failed -Count 3 | Get-AnsibleJobLog -Format ansi
==> [13] Job
(snip)
==> [12] Job
(snip)
==> [11] Job
(snip)
Retrieve the three jobs finished as successfull or failed, and show the their logs.
Get log with darck(black) background color. This would only affect HTML format.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Indicates download to files and download to the argument value's directory.
The file name format: <job-ID>.<format>
. eg.) 10.txt, 10.ansi, 10.html, 10.json
The only exception is SystemJob, which can only be downloaded as TEXT format.
Type: DirectoryInfo
Parameter Sets: DownloadTypeAndId, DownloadResource
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Log format:
txt
: Plain text (default)ansi
: Plain text with ANSI color (need Terminal supported VT100 escape sequence)html
: HTML formatjson
: JSON format (only affected when downloding. otherwise same asansi
)
The only exception is SystemJob, which can only be downloaded as text format.
Type: JobLogFormat
Parameter Sets: (All)
Aliases:
Accepted values: txt, ansi, json, html
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The ID of the Unified Job specified by the -Type
parameter.
Type: UInt64
Parameter Sets: StdOutTypeAndId, DownloadTypeAndId
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
UnifiedJob resource object from which to retrieve log.
The resource is an object with Id
and Type
properties.
And Type
should be following value:
Job
: JobTempalte's jobProjectUpdate
: Project's update jobInventoryUpdate
: InventorySource's update jobAdHocCommand
: AdHocCommand's jobWorkflowJob
: WorkflowJobTemplate's jobSystemJob
: SystemJobTemplate's job
Type: IResource
Parameter Sets: StdOutResource, DownloadResource
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Resource type name of the target UnifiedJob.
Type: ResourceType
Parameter Sets: StdOutTypeAndId, DownloadTypeAndId
Aliases:
Accepted values: Job, ProjectUpdate, InventoryUpdate, SystemJob, WorkflowJob, AdHocCommand
Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
The object has Id
and Type
properties.
And Type
should be following value:
Job
ProjectUpdate
InventoryUpdate
SystemJob
WorkflowJob
AdHocCommand
Job log string. (when not downloading)
Downloaded file objects.
Find-AnsibleInventoryUpdateJob
Invoke-AnsibleSystemJobTemplate