Skip to content

Install/update software on Windows hosts in an air-gapped network with Ansible.

License

Notifications You must be signed in to change notification settings

jamesfloresjr/ansible-role-win-install-software

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Ansible Role: win_install_software

Install/update software on Windows hosts in an air-gapped network with Ansible.

Requirements

Having Ansible setup for Microsoft Windows host communication. Click here to follow the Ansible Documentation step-by-step.

Prerequisites

1. Setting up the repository

The directory structure is as follows:

[repository]
├── [software-1]
│   ├── 1.1
│   │   └── installer_1.1.exe
│   ├── 1.2_latest
│   │   └── installer_1.2.exe
│   └── args.json
└── [software-2]
    ├── 2.1_latest
    │   └── installer_2.1.msi
    └── args.json

To setup, create a [repository] in a network share. In the root of the repository you just set up, create folders with the [software] names (e.g. "Firefox", "Putty", "Notepad++"). Inside those folders should exist folders with the version numbers. Make sure to rename the latest software with the tag _latest. The PowerShell script will fail if there is not a folder with this tag. Finally, in those individual folders should contain the executables ("exe" or "msi").

In each [software] folder, create a .json file containing arguments for the PowerShell script. For example:

{
    "exe_args":  "/S",
    "msi_args":  "/quiet",
    "preferred_installer": "exe"
}
Variable Description
exe_args You can find these by Googling "[software] installer command line options".
msi_args You can find these by running "msiexec.exe /help" in PowerShell or Cmd.
preferred_installer Specify which installer you want to prioritize (can be either "exe" or "msi").

2. Creating /vars/role_vars.yml

These are variables that Ansible will pass through to the PowerShell script:

---
# Do not include the trailing "\"
repository: "\\\\share\\windows_software"

# Name must match inside the repository structure
apps:
  - firefox
  - putty
  - notepad++
Variable Description
repository Input your repository without the trailing "\". Also, make sure to escape each "\" with another "\" (e.g. "\" turns into "\\").
apps This array will contain all of the software that you want to install/update. Make sure these match with the directory structure in your repository.

Example Playbook

---
- name: Install Windows Software
  hosts: windows_hosts
  gather_facts: no
  roles:
  - win_install_software

About

Install/update software on Windows hosts in an air-gapped network with Ansible.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published