Seems to work if you use a full path.
Also when you run bash.exe from a CMD window it executes the command in the 
current dir by looks of things

in wsl

cat test.sh
#!/bin/bash
ansible 10, -m win_ping
## end of test.sh



in CMD prompt:

bash -c "/home/jon/test.sh"

WIN10TEST| SUCCESS => {
    "changed": false,
    "ping": "pong"
}


On Friday, November 10, 2017 at 3:55:50 PM UTC, Smooge wrote:
>
> On 10 November 2017 at 08:51,  <[email protected] <javascript:>> wrote: 
> > Hi there, 
> > 
> > I succesfully installed ansible on windows 10 ubuntu. Everything 
> works... 
> > from ubuntu. 
> > 
> > However, calling a playbook via windows does not work: 
> > bash -c "~/test.sh" 
> > ERROR! the playbook:x.ymlcould not be found 
> > 
> > Ubuntu: 
> > #!/bin/bash 
> > cd /mnt/c/ops/ 
> > ansible-playbook bla bla command 
> > 
> > I guess bash -c uses the windows system where ansible does not run. 
> > 
>
> As far as I can tell it executes the linux sub-system as called and 
> will attempt to run the script. 
>
> I would try more debugging on your end as I am not sure exactly what 
> is going on environment wise on your system. 
>
> 1. How did you install ansible on the system 
> 2. Have the script print out the environment variables that are being 
> seen and compare them from the two runs. 
>
> I noticed a major difference between the environment variables when 
> running from power shell versus running in the environment. These 
> sorts of differences are expected because bash may not source certain 
> files depending on how it is invoked. My guess is that the python 
> fired inside of a Ubuntu is getting set up with certain paths and the 
> direct call isn't. 
>
>
> > My issue is that I need to automate stuff from powershell/scheduled 
> task. I 
> > need to connect to the windows 10 ubuntu and run the playbook. I had no 
> > success calling the playbook from cmd or powershell. 
> > 
> > Anybody know a way? 
> > 
> > 
> > -- 
> > 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 [email protected] <javascript:>. 
> > To post to this group, send email to [email protected] 
> <javascript:>. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/ansible-project/6e63f780-1ab4-4380-bc16-caa52123e7f5%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
> Stephen J Smoogen. 
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/33f86d55-9ead-463d-a3e7-a49eb91c04d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to