Install Windows Features and Roles With Ansible for Windows

In this blog post, I will show you how to install Windows Server (2019 and 2016) using Ansible for Windows with a playbook.

Ansible for Windows series

In the manage Windows with Ansible series, I showed you how to get started with Ansible and manage Windows machines using Playbooks and inventories.

Playbook

The following Ansible playbook will install Windows Deployment Services (WDS) and will restart the server if needed.

---
- name: "Work With Active Directory Machines"
  hosts: windows
  tasks:
    - name: "Install Windows Deployment Services" 
      win_feature:
            name:
              - WDS
              - WDS-Deployment
              - WDS-Transport   
            state: present
      register: win_feature
    - name: "Reboot server if needed"
      win_reboot:
      when: win_feature.reboot_required

Processing…
Success! You're on the list.

Posted

in

by