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:
- Create a new file named
configure_iis_web_server.yml
. - Add the
hosts
line targeting theall
group.
Press + to interact
---- hosts: all
- Use
vars_prompts
to prompt for a username and password.
Press + to interact
vars_prompt:- name: usernameprompt: "Enter local username"private: no- name: passwordprompt: "Enter password
- Define the connection variables for a Windows host.
Press + to interact
vars:ansible_user: "{{ username }}"ansible_password: "{{ password }}"ansible_connection: winrmansible_winrm_transport: ntlmansible_winrm_server_cert_validation: ignore
- Add the tasks list.
Press + to interact
tasks:
- Install the
web-server
feature and all subfeatures with thewin_feature
module.
Press + to interact
- name: Install IISwin_feature:name: web-serverinclude_management_tools: yesinclude_sub_features: yesstate: 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 ...