Re: [ansible-project] WSL1 localhost

2023-07-05 Thread jbor...@gmail.com
Sure you can run powershell.exe directly with raw/shell/command as the 
executable but as I mentioned the localhost on WSL refers to the Linux 
host. The only way to run the Windows PowerShell modules is to target the 
host through winrm/psrp so the remote host is on the Windows side.

On Thursday, July 6, 2023 at 3:23:25 AM UTC+10 Filipe Gonçalves wrote:

> I can run powershell in wsl and i can run
> raw: powershell.exe on ansible
>
> my problem is that win packages are just not working altogether
>
> A quarta, 28/06/2023, 16:50, John Petro  escreveu:
>
>> If I am reading the output correctly, it looks like it can't find 
>> powershell.  have you tried running a powershell command in WSL to see if 
>> you get that expected output?
>>
>> --John
>>
>> On Wed, Jun 28, 2023 at 11:40 AM Filipe Gonçalves  
>> wrote:
>>
>>> ### Summary
>>>
>>> When running a simple playbook that uses the ansible.windows.* 
>>> module(i've tested some ansible.windows, not all) it always fails on 
>>> runtime, I'm using WSL1 on Windows 10, so I imagine it is because it is 
>>> recognizing localhost as the wsl virtual machine and not my windows 
>>> machine, I'm unsure if this is the case since im new to Ansible, but I have 
>>> researched this quite a bit and didn't find a concrete awnser.
>>>
>>> My inventory
>>> [localhost]
>>> 127.0.0.1 ansible_connection=local
>>>
>>> Can upgrading the WSL version to WSL2 fix this issue?
>>>
>>>
>>> ### Ansible Version
>>> $ ansible --version
>>> ansible [core 2.14.5]
>>>
>>>
>>> ### OS / Environment
>>>
>>> WSL1, Windows 10
>>>
>>> ### Steps to Reproduce
>>> - name: test
>>>   hosts: localhost
>>>   gather_facts: false
>>>
>>>   tasks:
>>> - name: Run basic PowerShell script
>>>   ansible.windows.win_powershell:
>>> script: |
>>>   echo "Hello World"
>>>
>>>
>>> ### Expected Results
>>>
>>> Hello World
>>>
>>> ### Actual Results
>>> fatal: [127.0.0.1]: FAILED! => {
>>> "changed": false,
>>> "module_stderr": "/bin/sh: 1: powershell: not found\n",
>>> "module_stdout": "",
>>> "msg": "The module failed to execute correctly, you probably need to 
>>> set the interpreter.\nSee stdout/stderr for the exact error",
>>> "rc": 127
>>> }
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Ansible Project" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to ansible-proje...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/6164a4d5-a582-4586-ac4b-1c7403512ab8n%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to ansible-proje...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/CAPAjob8FVHD365ozTR0zEvRWQHmZe294niAzCe20H6_i5uRhxw%40mail.gmail.com
>>  
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3d3f67ee-4278-4f4f-90db-33cf25670dc4n%40googlegroups.com.


Re: [ansible-project] WSL1 localhost

2023-07-05 Thread Filipe Gonçalves
I can run powershell in wsl and i can run
raw: powershell.exe on ansible

my problem is that win packages are just not working altogether

A quarta, 28/06/2023, 16:50, John Petro  escreveu:

> If I am reading the output correctly, it looks like it can't find
> powershell.  have you tried running a powershell command in WSL to see if
> you get that expected output?
>
> --John
>
> On Wed, Jun 28, 2023 at 11:40 AM Filipe Gonçalves <
> filipe.pereira@gmail.com> wrote:
>
>> ### Summary
>>
>> When running a simple playbook that uses the ansible.windows.*
>> module(i've tested some ansible.windows, not all) it always fails on
>> runtime, I'm using WSL1 on Windows 10, so I imagine it is because it is
>> recognizing localhost as the wsl virtual machine and not my windows
>> machine, I'm unsure if this is the case since im new to Ansible, but I have
>> researched this quite a bit and didn't find a concrete awnser.
>>
>> My inventory
>> [localhost]
>> 127.0.0.1 ansible_connection=local
>>
>> Can upgrading the WSL version to WSL2 fix this issue?
>>
>>
>> ### Ansible Version
>> $ ansible --version
>> ansible [core 2.14.5]
>>
>>
>> ### OS / Environment
>>
>> WSL1, Windows 10
>>
>> ### Steps to Reproduce
>> - name: test
>>   hosts: localhost
>>   gather_facts: false
>>
>>   tasks:
>> - name: Run basic PowerShell script
>>   ansible.windows.win_powershell:
>> script: |
>>   echo "Hello World"
>>
>>
>> ### Expected Results
>>
>> Hello World
>>
>> ### Actual Results
>> fatal: [127.0.0.1]: FAILED! => {
>> "changed": false,
>> "module_stderr": "/bin/sh: 1: powershell: not found\n",
>> "module_stdout": "",
>> "msg": "The module failed to execute correctly, you probably need to
>> set the interpreter.\nSee stdout/stderr for the exact error",
>> "rc": 127
>> }
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to ansible-project+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/6164a4d5-a582-4586-ac4b-1c7403512ab8n%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAPAjob8FVHD365ozTR0zEvRWQHmZe294niAzCe20H6_i5uRhxw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALSWZeGWzLaoQ%3DQaXe74QKBWwiGYiesVxHybA0e%2BYCu%3DvbFiew%40mail.gmail.com.


Re: [ansible-project] WSL1 localhost

2023-06-28 Thread jbor...@gmail.com
Localhost on the WSL side is the WSL Linux host itself and not the Windows 
one. Unfortunately you still need to target your Windows localhost using 
the winrm or psrp connection type.

Thanks

Jordan
On Thursday, June 29, 2023 at 1:50:54 AM UTC+10 John Petro wrote:

> If I am reading the output correctly, it looks like it can't find 
> powershell.  have you tried running a powershell command in WSL to see if 
> you get that expected output?
>
> --John
>
> On Wed, Jun 28, 2023 at 11:40 AM Filipe Gonçalves  
> wrote:
>
>> ### Summary
>>
>> When running a simple playbook that uses the ansible.windows.* 
>> module(i've tested some ansible.windows, not all) it always fails on 
>> runtime, I'm using WSL1 on Windows 10, so I imagine it is because it is 
>> recognizing localhost as the wsl virtual machine and not my windows 
>> machine, I'm unsure if this is the case since im new to Ansible, but I have 
>> researched this quite a bit and didn't find a concrete awnser.
>>
>> My inventory
>> [localhost]
>> 127.0.0.1 ansible_connection=local
>>
>> Can upgrading the WSL version to WSL2 fix this issue?
>>
>>
>> ### Ansible Version
>> $ ansible --version
>> ansible [core 2.14.5]
>>
>>
>> ### OS / Environment
>>
>> WSL1, Windows 10
>>
>> ### Steps to Reproduce
>> - name: test
>>   hosts: localhost
>>   gather_facts: false
>>
>>   tasks:
>> - name: Run basic PowerShell script
>>   ansible.windows.win_powershell:
>> script: |
>>   echo "Hello World"
>>
>>
>> ### Expected Results
>>
>> Hello World
>>
>> ### Actual Results
>> fatal: [127.0.0.1]: FAILED! => {
>> "changed": false,
>> "module_stderr": "/bin/sh: 1: powershell: not found\n",
>> "module_stdout": "",
>> "msg": "The module failed to execute correctly, you probably need to 
>> set the interpreter.\nSee stdout/stderr for the exact error",
>> "rc": 127
>> }
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to ansible-proje...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/6164a4d5-a582-4586-ac4b-1c7403512ab8n%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8217c342-314f-4e16-80b2-8919f2653f32n%40googlegroups.com.


Re: [ansible-project] WSL1 localhost

2023-06-28 Thread John Petro
If I am reading the output correctly, it looks like it can't find
powershell.  have you tried running a powershell command in WSL to see if
you get that expected output?

--John

On Wed, Jun 28, 2023 at 11:40 AM Filipe Gonçalves <
filipe.pereira@gmail.com> wrote:

> ### Summary
>
> When running a simple playbook that uses the ansible.windows.* module(i've
> tested some ansible.windows, not all) it always fails on runtime, I'm using
> WSL1 on Windows 10, so I imagine it is because it is recognizing localhost
> as the wsl virtual machine and not my windows machine, I'm unsure if this
> is the case since im new to Ansible, but I have researched this quite a bit
> and didn't find a concrete awnser.
>
> My inventory
> [localhost]
> 127.0.0.1 ansible_connection=local
>
> Can upgrading the WSL version to WSL2 fix this issue?
>
>
> ### Ansible Version
> $ ansible --version
> ansible [core 2.14.5]
>
>
> ### OS / Environment
>
> WSL1, Windows 10
>
> ### Steps to Reproduce
> - name: test
>   hosts: localhost
>   gather_facts: false
>
>   tasks:
> - name: Run basic PowerShell script
>   ansible.windows.win_powershell:
> script: |
>   echo "Hello World"
>
>
> ### Expected Results
>
> Hello World
>
> ### Actual Results
> fatal: [127.0.0.1]: FAILED! => {
> "changed": false,
> "module_stderr": "/bin/sh: 1: powershell: not found\n",
> "module_stdout": "",
> "msg": "The module failed to execute correctly, you probably need to
> set the interpreter.\nSee stdout/stderr for the exact error",
> "rc": 127
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/6164a4d5-a582-4586-ac4b-1c7403512ab8n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAPAjob8FVHD365ozTR0zEvRWQHmZe294niAzCe20H6_i5uRhxw%40mail.gmail.com.


[ansible-project] WSL1 localhost

2023-06-28 Thread Filipe Gonçalves
### Summary

When running a simple playbook that uses the ansible.windows.* module(i've 
tested some ansible.windows, not all) it always fails on runtime, I'm using 
WSL1 on Windows 10, so I imagine it is because it is recognizing localhost 
as the wsl virtual machine and not my windows machine, I'm unsure if this 
is the case since im new to Ansible, but I have researched this quite a bit 
and didn't find a concrete awnser.

My inventory
[localhost]
127.0.0.1 ansible_connection=local

Can upgrading the WSL version to WSL2 fix this issue?


### Ansible Version
$ ansible --version
ansible [core 2.14.5]


### OS / Environment

WSL1, Windows 10

### Steps to Reproduce
- name: test
  hosts: localhost
  gather_facts: false

  tasks:
- name: Run basic PowerShell script
  ansible.windows.win_powershell:
script: |
  echo "Hello World"


### Expected Results

Hello World

### Actual Results
fatal: [127.0.0.1]: FAILED! => {
"changed": false,
"module_stderr": "/bin/sh: 1: powershell: not found\n",
"module_stdout": "",
"msg": "The module failed to execute correctly, you probably need to 
set the interpreter.\nSee stdout/stderr for the exact error",
"rc": 127
}

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6164a4d5-a582-4586-ac4b-1c7403512ab8n%40googlegroups.com.