How to pass a variable through the environment ? #2549
Andrei9385
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello.
I have a simple playbook that runs successfully.
`---
hosts: AdminTools
vars:
ansible_shell_type: 'cmd'
tasks:
ansible.windows.win_powershell:
script: |
$value = Test-Path -Path C:\temp\1
if ($value) {
Remove-Item -Path C:\temp\1 -Force
}
`
I want to move a variable to the environment. I remove from playbook: ansible_shell_type: 'cmd'
`---
hosts: AdminTools
tasks:
ansible.windows.win_powershell:
script: |
$value = Test-Path -Path C:\temp\1
if ($value) {
Remove-Item -Path C:\temp\1 -Force
}`
Now I'm getting an error:
The task template uses this environment. What's wrong?
Beta Was this translation helpful? Give feedback.
All reactions