44 lines
1.2 KiB
YAML
44 lines
1.2 KiB
YAML
---
|
|
- name: Install and configure IIS
|
|
hosts: web_servers
|
|
gather_facts: true
|
|
|
|
tasks:
|
|
- name: Install IIS features
|
|
ansible.windows.win_feature:
|
|
name: "{{ iis_features }}"
|
|
state: present
|
|
register: iis_install
|
|
|
|
- name: Reboot if required
|
|
ansible.windows.win_reboot:
|
|
reboot_timeout: 3600
|
|
when: iis_install.reboot_required
|
|
|
|
- name: Create demo web content
|
|
ansible.windows.win_copy:
|
|
content: |
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Demo IIS Site - {{ inventory_hostname }}</title>
|
|
</head>
|
|
<body>
|
|
<h1>Welcome to {{ inventory_hostname }}</h1>
|
|
<p>This server was configured by Ansible Automation Platform</p>
|
|
<p>Deployment Date: {{ ansible_date_time.iso8601 }}</p>
|
|
</body>
|
|
</html>
|
|
dest: "{{ iis_website_path }}\\index.html"
|
|
|
|
- name: Ensure IIS service is running
|
|
ansible.windows.win_service:
|
|
name: W3SVC
|
|
state: started
|
|
start_mode: auto
|
|
|
|
- name: Update CMDB with IIS installation
|
|
ansible.builtin.debug:
|
|
msg: "Would update ServiceNow CMDB with IIS installation"
|
|
# TODO: Implement ServiceNow CMDB update
|