Hiii
Thanks for your reply
[root@ansible-server ansible]# ansible-playbook notepad.yml -vvv
Using /etc/ansible/ansible.cfg as config file
ERROR! 'win_get_url' is not a valid attribute for a Play
The error appears to have been in '/etc/ansible/notepad.yml': line 1,
column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: test raw module
^ here
This is my yml file
[root@ansible-server ansible]# cat notepad.yml
- name: test raw module
hosts: windows
tasks:
win_get_url:
url:
https://notepad-plus-plus.org/repository/7.x/7.5.3/npp.7.5.3.Installer.exe
dest: "{{ C:\tmp }}npp.7.5.3.Installer.exe"
- name: install notepad plus plus
win_shell: "{{ C:\tmp }}npp.7.5.3.Installer.exe /S"
getting this error
On Fri, Dec 8, 2017 at 5:30 PM, 'J Hawkesworth' via Ansible Project <
[email protected]> wrote:
> Not sure what c:\tmp\notepad.exe is in your example, but here is how I
> install notepad++
>
> {{ deploy_dir }} is a staging location where I keep files to be
> installed. I guess you could use C:\tmp for that if it makes sense for you.
>
> the /S makes the notepad++ installer run in silent, or 'unattended' mode.
> Without this it will pop up a user interface on the target windows machine,
> which will never be visible, so the task will just and and eventually it
> will timeout, as you have seen.
>
> A lot of windows installers need telling to run in silent/unattended mode
> otherwise they will do this. Windows often assumes there is someone
> sitting in front of the computer installing software.
>
> I'd suggest trying win_chocolatey module if you can as that makes
> installing many popular windows programs about as easy it can be.
>
> Hope this helps,
>
> Jon
>
> - name: use win_get_url module to download notepad plus plus
> win_get_url:
> url: https://notepad-plus-plus.org/repository/7.x/7.5.3/npp.7.5.
> 3.Installer.exe
> dest: "{{ deploy_dir }}npp.7.5.3.Installer.exe"
>
>
> - name: install notepad plus plus
>
> win_shell: "{{ deploy_dir }}npp.7.5.3.Installer.exe /S"
>
>
>
>
>
>
>
>
>
> On Tuesday, December 5, 2017 at 4:49:00 AM UTC, shilpa motghare wrote:
>>
>> Thanks
>>
>> It works, I am able to do ping pong to my windows client but not able to
>> install a .exe packages through ansible this is my output
>>
>> ansible windows -m win_ping
>> Lenovo-PC | SUCCESS => {
>> "changed": false,
>> "ping": "pong"
>> }
>>
>> And my windows.yml file is:
>> ansible_user: Administrator
>> ansible_password: ********
>> ansible_ssh_port: 5985
>> ansible_connection: winrm
>> ansible_winrm_server_cert_validation: ignore
>>
>> but now I want to install a notepad++ on windows via ansible this is my
>> notepad.yml file:
>>
>> - name: test raw module
>> hosts: windows
>> tasks:
>> - name: Install Notepad plus
>> win_package:
>> path: C:\tmp\notepad.exe
>> product_id:
>> state: present
>> It take too much time for the output and it come with error the
>> screenshot of error I am attaching here.
>>
>> Please help me why this happening.
>>
>> On Thu, Nov 23, 2017 at 12:26 PM, Soniya panwar <[email protected]>
>> wrote:
>>
>>> Hello,
>>>
>>> There could be a few things not correctly configured or missed that
>>> could result into below error:
>>>
>>>
>>> First and foremost, while installing Ansible, did you resolve
>>> dependencies for paramiko, PyYAML, Jinja2 and httplib2 packages? If not,
>>> you may execute below commands on the linux machine with Ansible
>>> installation.
>>>
>>> 1. $ sudo pip install paramiko PyYAML Jinja2 httplib2
>>>
>>> 2. $ pip install "pywinrm>=0.1.1"
>>>
>>> 3. $ pip install http://github.com/diyan/pywinr
>>> m/archive/master.zip#egg=pywinrm
>>>
>>>
>>>
>>> Secondly, verify that the version of Microsoft.NET Framework is 4.0 or
>>> later. If not you may follow below steps to get it upgraded.
>>>
>>> 1. Click on Start -> Control Panel -> Program and Features -> Add
>>> or Remove Programs.
>>>
>>> 2. Scroll down to the M's and look for Microsoft .NET Framework.
>>> If you don't have version 4.0 or later, download and install it from here “
>>> https://www.microsoft.com/en-us/download/details.aspx?id=30653”.
>>>
>>>
>>>
>>> Thirdly, the ansible_user used in windows.yml file should have admin
>>> privileges on remote windows machine to make connection to PowerShell. You
>>> may follow below steps to grant admin privileges to the user, if not
>>> provided already.
>>>
>>> 1. Click on Start -> Control Panel -> User Accounts -> Manage
>>> User Accounts.
>>>
>>> 2. Select your new account and click on Properties.
>>>
>>> 3. Click on the Group Membership tab and change the Group
>>> Membership from Standard User to Administrator.
>>>
>>> 4. Click OK, OK and Close. Restart computer.
>>>
>>> *Note*:- The remote computer need not be logged into this account for
>>> Ansible to make a remote connection to PowerShell, but the account must
>>> exist.
>>>
>>>
>>>
>>> Last but not the least, you need to execute a PowerShell script in order
>>> to enable WinRM/PS Remoting. Below are the steps to be followed.
>>>
>>> 1. Start PowerShell and run the command Set-ExecutionPolicy
>>> -ExecutionPolicy Unrestricted
>>>
>>> 2. Download PowerShell script (named
>>> ConfigureRemotingForAnsible.ps1) for enabling WinRM/PSRemoting. You
>>> can get the most recent version here:
>>> “https://github.com/ansible/ansible/blob/devel/examples/scri
>>> pts/ConfigureRemotingForAnsible.ps1”.
>>>
>>> 3. And then run the PowerShell script :
>>>
>>> • powershell.exe -File
>>> ConfigureRemotingForAnsible.ps1
>>>
>>> Pass the -CertValidityDays option to customize the
>>> expiration date of the generated certificate:
>>>
>>> • powershell.exe -File
>>> ConfigureRemotingForAnsible.ps1 -CertValidityDays 100
>>>
>>> Pass the -EnableCredSSP switch to enable CredSSP as an
>>> authentication option:
>>>
>>> • powershell.exe -File ConfigureRemotingForAnsible.ps1
>>> –EnableCredSSP
>>>
>>> Pass the -ForceNewSSLCert switch to force a new SSL
>>> certificate to be attached to an already existing winrm listener.
>>>
>>> • powershell.exe -File ConfigureRemotingForAnsible.ps1
>>> –ForceNewSSLCert
>>>
>>> Pass the -SkipNetworkProfileCheck switch to configure winrm
>>> to listen on PUBLIC zone interfaces.
>>>
>>> • powershell.exe -File ConfigureRemotingForAnsible.ps1
>>> –SkipNetworkProfileCheck
>>>
>>> Additionally the -Verbose option can be used to get more
>>> information on screen about what it is doing
>>>
>>> • powershell.exe -File ConfigureRemotingForAnsible.ps1
>>> –Verbose
>>>
>>>
>>>
>>> Output of this command should be like this:
>>>
>>> VERBOSE: Verifying WinRM service.
>>>
>>> VERBOSE: PS Remoting is already enabled.
>>>
>>> VERBOSE: SSL listener is already active.
>>>
>>> VERBOSE: Basic auth is already enabled.
>>>
>>> VERBOSE: Firewall rule already exists to allow WinRM HTTPS.
>>>
>>> VERBOSE: HTTP: Enabled | HTTPS: Enabled
>>>
>>> VERBOSE: PS Remoting has been successfully configured for Ansible.
>>>
>>>
>>>
>>> 4. Run the PowerShell command Set-ExecutionPolicy
>>> -ExecutionPolicy Restricted.
>>>
>>> 5. Close PowerShell.
>>>
>>> If all of the above steps are performed correctly, you should get a
>>> successful ping-pong from your remote windows node.
>>>
>>>
>>>
>>>
>>> Thanks
>>>
>>> Soniya
>>>
>>>
>>> On Tuesday, November 21, 2017 at 7:33:40 PM UTC+5:30, shilpa motghare
>>> wrote:
>>>>
>>>> Guys Need help here I am posting /etc/ansible/hosts file for windows
>>>> entry is
>>>> [windows]
>>>> Lenovo-PC
>>>>
>>>> Lenovo-PC entry is added in my /etc/hosts file
>>>>
>>>> AND
>>>>
>>>> /etc/ansible/windows.yml file is
>>>> ansible_user: Administrator
>>>> ansible_password:
>>>> ansible_port: 5985
>>>> ansible_connection: winrm
>>>> ansible_winrm_scheme: http
>>>> ansible_winrm_server_cert_validation: ignore
>>>>
>>>> and run command
>>>> ansible windows -m win_ping
>>>>
>>>> But Still GET ERROR
>>>>
>>>> Lenovo-PC | UNREACHABLE! => {
>>>> "changed": false,
>>>> "msg": "Failed to connect to the host via ssh: ssh: connect to host
>>>> lenovo-pc port 22: Connection refused\r\n",
>>>> "unreachable": true
>>>> }
>>>>
>>>> PLEASE HELLPPP!!!!!!!!
>>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Ansible Project" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>>> pic/ansible-project/jnE-wYRvCl8/unsubscribe.
>>> To unsubscribe from this group and all its topics, 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/ms
>>> gid/ansible-project/29d3ae1e-4ee9-456b-9083-9564a287c7ab%
>>> 40googlegroups.com
>>> <https://groups.google.com/d/msgid/ansible-project/29d3ae1e-4ee9-456b-9083-9564a287c7ab%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 a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ansible-project/jnE-wYRvCl8/unsubscribe.
> To unsubscribe from this group and all its topics, 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/6c1eb6e6-324d-4681-be98-ed8674b85592%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/6c1eb6e6-324d-4681-be98-ed8674b85592%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 [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/CAHF9F3Tm%3DF-yFTkam93xN8UA_Ur%2BZcuHPRLPBe5m%2BYTGStDXFQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.