Please clarify a couple questions:

1. You're running the ansible command from a Linux (RedHat, Ubuntu, CentOS, 
Debian) system, correct?

2. The playbook you're using has these tasks:

- name: Copy script from local to remote server

    win_copy:

       src: files

       dest: C:\

       register: myfile

  - debug: var=myfile

  - win_command: powershell.exe -ExecutionPolicy ByPass -File 
C:/userdata-winsetup.ps1


3. The directory where your playbook and inventory file reside also have a 
directory called "files".


4. Your inventory file has this section:

[windows]

127.0.0.1


Based on your inventory file, you're attempting to run the commands in the 
playbook on the system you're running Ansible on.  Your inventory file 
probably needs the _windows_ server listed in the "[windows]" section like 
this:


[windows]

MyWinSys01.example.com


Then when you run your playbook with Ansible, it will connect using the 
"winrm" protocol and login with "admin" (password: "admin"), then copy the 
files from ".\files\" to "c:\" on the remote system.


Once you've validated all that, please re-run the playbook with "-v" (or 
more for additional verbose output) and post it here.


Thanks,

DanL


On Monday, April 15, 2019 at 4:53:45 AM UTC, gottumukkala srija wrote:
>
> I changed localhost to remote_host as suggested, but while running the 
> playbook getting error as "no hosts matched". 
>
> Is there any possible way that we can get on call to discuss 
> further....Please suggest..!!!
>
> On Friday, April 12, 2019 at 4:02:12 PM UTC+5:30, CORLEONE## wrote:
>>
>> If u want to copy from local to remote u should mention -host: 
>> remote_host....i think u r using localhost
>>
>> On Fri, 12 Apr 2019, 14:36 gottumukkala srija, <srij...@gmail.com> wrote:
>>
>>> localhost is windows. And we are using win_copy for copying the file. 
>>> Any alternative for this?
>>>
>>> On Friday, April 12, 2019 at 2:27:27 PM UTC+5:30, CORLEONE## wrote:
>>>>
>>>> its a module failure...is the localhost linux or windows.???...win_copy 
>>>> works for windows ...for rest use copy module
>>>>
>>>> On Fri, 12 Apr 2019, 14:02 gottumukkala srija, <srij...@gmail.com> 
>>>> wrote:
>>>>
>>>>> Hi Jordan,
>>>>>
>>>>> Can you please describe it briefly? You want us to create a new VM and 
>>>>> then point that IP to add_host?
>>>>>
>>>>> On Thursday, April 11, 2019 at 12:30:28 PM UTC+5:30, Jordan Borean 
>>>>> wrote:
>>>>>>
>>>>>> If your inventory is targeting localhost then that means it's trying 
>>>>>> to run a Windows module on the Ansible controller which won't work. You 
>>>>>> cna 
>>>>>> use the azure_rm_virtualmachine module to spin up a host but then you 
>>>>>> will 
>>>>>> have to use something like 'add_host' [1] to add the host for the 
>>>>>> current 
>>>>>> execution then change the play to that new host.
>>>>>>
>>>>>> [1] 
>>>>>> https://docs.ansible.com/ansible/latest/modules/add_host_module.html
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Jordan
>>>>>>
>>>>> -- 
>>>>> 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...@googlegroups.com.
>>>>> To post to this group, send email to ansible...@googlegroups.com.
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/ansible-project/8254df4c-e104-405f-b9b8-08080ce5e0e0%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/ansible-project/8254df4c-e104-405f-b9b8-08080ce5e0e0%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>> -- 
>>> 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...@googlegroups.com.
>>> To post to this group, send email to ansible...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/3ca787be-1724-4329-8dc1-1e5c58371122%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/ansible-project/3ca787be-1724-4329-8dc1-1e5c58371122%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/984eb5ce-65db-4f8b-a726-5f3d2a984a0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to