Install software to Windows machine...

166 views
Skip to first unread message

aaron.t...@total.care

unread,
May 31, 2016, 4:54:38 PM5/31/16
to Ansible Project
Thanks for all your help earlier, it was greatly appreciated.

Now I am attempting to automate installation of some software across all my Windows VM's .  I have found some documentation on the web but am still having trouble.  At this point it is getting hung up on the last line.
The playbook looks like this...

---
- hosts: Windows
  connection: local
  remote_user: root
  tasks:
    - name: check to see if ClamWin installed
      win-stat: "S:\\ClamWin\"
      register: ClamWin installed
      
    - name:  Install ClamWin
      win_package:
       name=clamwin-0.99.1-setup.exe
       path=S://ClamWin/clamwin-0.99.1-setup.exe
       Arguments="/install /passive /norestart"

Can i get some help with this code????

Basically i have a file on a local shared drive that I want to install on my windows machines.
Thanks.

Johannes Kastl

unread,
Jun 1, 2016, 1:19:28 PM6/1/16
to ansible...@googlegroups.com
On 31.05.16 22:54 aaron.t...@total.care wrote:

> Basically i have a file on a local shared drive that I want to install on
> my windows machines.

I think I remember reading that in this case you should split the
task: download the file and then install it.

Maybe split the task even further, as connecting to a target via
ansible and then connection to yet another server to get the file
might pose a problem.

So:
Get the file on the controller
Push the file to the target
Install the file.

Just an idea,
Johannes


signature.asc

Trond Hindenes

unread,
Jun 2, 2016, 2:39:22 PM6/2/16
to Ansible Project
is "S:" a local or mapped drive?

Johannes Kastl

unread,
Jun 2, 2016, 3:04:47 PM6/2/16
to ansible...@googlegroups.com
On 02.06.16 20:39 Trond Hindenes wrote:
> is "S:" a local or mapped drive?
>
How should I know, it's your machine... ;-)

Just try and log into the machine, copy the file from S:\... to
somewhere on C: (where your user has the rights) and then try to run
your playbook with this path...

Johannes

signature.asc

gdel...@gmail.com

unread,
Jun 4, 2016, 1:11:08 AM6/4/16
to Ansible Project
Try the below as long as you have your WinRm creds configured correctly within ansible it should use those creds to connect to your Windows hosts. The below register the path of S:\ClaimWin to that variable you can use that later for any purpose you need. It then copies the file locally onto c:/temp/ then installs it once the installs complete it removes it from c:/temp.

---
- hosts: Windows
  tasks:
    - name: check to see if ClamWin installed
      win-stat: S:\ClamWin\
      register: ClamWin_installed

    - name: Copy file locally
    - win_copy: src=S:\ClamWin\clamwin-0.99.1-setup.exe dest=c:/temp/clamwin-0.99.1-setup.exe
      
    - name:  Install ClamWin
      win_package:
       name=clamwin-0.99.1-setup.exe
       path=c:/temp/clamwin-0.99.1-setup.exe
       Arguments="/install /passive /norestart"

    - name: Remove local file
    - win_file: path=c:/temp/clamwin-0.99.1-setup.exe state=absent 

Trond Hindenes

unread,
Jun 4, 2016, 1:56:42 PM6/4/16
to Ansible Project
The reason I'm asking if S is local or shared is that if its a mapped network drive and you're using Kerberos authentication it basically won't work out of the box, because of limitations around double-hop remoting. You can either use trust for delegation, or switch to another (basic or NTLM auth scheme).
Reply all
Reply to author
Forward
0 new messages