mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 19:31:26 -07:00
async: use async_dir for the async results file directory (#45461)
* win async: use async_dir for the async results file directory * tried to unify POSIX and PowerShell async implementations of async_dir * fix sanity issue
This commit is contained in:
parent
60979a96a9
commit
5c73d4f4bd
11 changed files with 269 additions and 19 deletions
|
@ -12,6 +12,17 @@ DOCUMENTATION = '''
|
|||
description:
|
||||
- The only option when using 'winrm' as a connection plugin
|
||||
options:
|
||||
async_dir:
|
||||
description:
|
||||
- Directory in which ansible will keep async job information.
|
||||
- Before Ansible 2.8, this was set to C(remote_tmp + "\\.ansible_async").
|
||||
default: '%USERPROFILE%\\.ansible_async'
|
||||
ini:
|
||||
- section: powershell
|
||||
key: async_dir
|
||||
vars:
|
||||
- name: ansible_async_dir
|
||||
version_added: '2.8'
|
||||
remote_tmp:
|
||||
description:
|
||||
- Temporary directory to use on targets when copying files to the host.
|
||||
|
@ -1213,14 +1224,18 @@ $exec_wrapper = {
|
|||
|
||||
|
||||
Function Run($payload) {
|
||||
$remote_tmp = $payload["module_args"]["_ansible_remote_tmp"]
|
||||
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
|
||||
if ($payload.environment.ContainsKey("ANSIBLE_ASYNC_DIR")) {
|
||||
$async_dir = $payload.environment.ANSIBLE_ASYNC_DIR
|
||||
} else {
|
||||
$async_dir = "%USERPROFILE%\.ansible_async"
|
||||
}
|
||||
$async_dir = [System.Environment]::ExpandEnvironmentVariables($async_dir)
|
||||
|
||||
# calculate the result path so we can include it in the worker payload
|
||||
$jid = $payload.async_jid
|
||||
$local_jid = $jid + "." + $pid
|
||||
|
||||
$results_path = [System.IO.Path]::Combine($remote_tmp, ".ansible_async", $local_jid)
|
||||
$results_path = [System.IO.Path]::Combine($async_dir, $local_jid)
|
||||
|
||||
$payload.async_results_path = $results_path
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue