Windows Software Deployment mit ansible

30 Juli 2019

Auf Windows-PC

Policie anpasssen: Skripte erlauben

In Powershell (Administrator) eingeben:

Set-ExecutionPolicy RemoteSigned

ConfigureRemotingForAnsible

Skript herunterladen und ausführen:

Invoke-WebRequest https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1 -out ConfigureRemotingForAnsible.ps1
.\ConfigureRemotingForAnsible.ps1

Auf Ansible Host

Hosts Datei Beispiel

/etc/ansible/hosts

[win]
win-pc1
win-pc2

[win:vars]
ansible_user=username
ansible_password=mostsecurepassword
ansible_connection=winrm
ansible_winrm_server_cert_validation=ignore

Playbook Beispiele mit win_package

7-Zip

- hosts: win
  tasks:
  - name: Install 7zip
    win_package:
      path: https://www.7-zip.org/a/7z1900-x64.msi
      creates_version: 19.00
      creates_path: 'C:\Program Files\7-Zip\7z.exe'
      state: present
#      become: yes
#      become_method: runas
#      become_flags: logon_type=new_credentials logon_flags=net_credentials_only
#      vars:
#          ansible_become_user: DOMAIN\admin
#          ansible_become_pass: mostsecurepassword

vlc

  - name: Install vlc
    win_package:
      path: https://download.videolan.org/vlc/last/win64/vlc-3.0.6-win64.msi
      creates_version: 3.0.6
      creates_path: C:\Program Files (x86)\VideoLAN\VLC\vlc.exe
      state: present

Playbook Beispiel mit win_chocolatey

- hosts: win
  tasks:

  - name: Manage SW
    win_chocolatey:
      name:
      - firefox
      - notepadplusplus
      - 7zip
      - foobar2000
      - vscode
      - keepassxc
      - virtualbox
      - mumble
      - winscp
      - veracrypt
      - choco-upgrade-all-at-startup
      state: present

  - name: Upgrade installed packages
    win_chocolatey:
      name: all
      state: latest