In this blog post, I will show you how to install Windows Server roles and features with Ansible.
With Ansible we can manage Windows server VM and physical hosts without installing an agent.
To complete this post and install roles and feature, please follow the requirements below:
Below, is my YAML playbook file that I will use to install Windows IIS server 10 on my Windows Server 2019 VM.
--- - hosts: windows tasks: - name: Install IIS Server 10 win_feature: name: Web-Server state: present
If you need to install more than one role or feature, see the code below on how to install multiple roles.
--- - hosts: windows tasks: - name: Install IIS Server 10 win_feature: name: - Web-Server - Web-Mgmt-Console state: present
Before running my playbook, I will check if IIS is on my VM and as you can see it is not.
I will run my playbook using the following code.
When Ansible is installing something on a Windows server, you will see the following process running.
After a minute, I will recheck my server, and as you can see, IIS is available.