...

/

Configure a Windows IIS Web Server

Configure a Windows IIS Web Server

Configure a Windows host IIS (Internet Information Services) web server with an Ansible playbook.

We'll cover the following...

Let’s configure a Windows host to run an IIS(Internet Information Services) web server with an Ansible playbook. You’ll perform the following steps:

  1. Create a new file named configure_iis_web_server.yml.
  2. Add the hosts line targeting the all group.
Press + to interact
---
- hosts: all
  1. Use vars_prompts to prompt for a username and password.
Press + to interact
vars_prompt:
- name: username
prompt: "Enter local username"
private: no
- name: password
prompt: "Enter password
  1. Define the connection variables for a Windows host.
Press + to interact
vars:
ansible_user: "{{ username }}"
ansible_password: "{{ password }}"
ansible_connection: winrm
ansible_winrm_transport: ntlm
ansible_winrm_server_cert_validation: ignore
  1. Add the tasks list.
Press + to interact
tasks:
  1. Install the web-server feature and all subfeatures with the win_feature module.
Press + to interact
- name: Install IIS
win_feature:
name: web-server
include_management_tools: yes
include_sub_features: yes
state: present

win_feature is an Ansible module used to install or uninstall roles or features for Windows servers. It requires the name parameter, which is passed as a web-server. web-server is the Windows feature’s name to install IIS.

include_management_tools is specified and provided a ...