Skip to content

Commit b7538ef

Browse files
authored
Merge pull request #2291 from rlopez133/issue_2139
Fixing documentation so that the IIS can install properly
2 parents 2e423a9 + d65f14e commit b7538ef

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

exercises/ansible_windows/3-playbook/README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ of this exercise.
105105
ansible.windows.win_feature:
106106
name: Web-Server
107107
state: present
108+
register: win_feature
109+
110+
- name: Reboot if installing Web Server feature requires it
111+
ansible.windows.win_reboot:
112+
when: win_feature.reboot_required
108113
109114
- name: Start iis service
110115
ansible.windows.win_service:
@@ -137,8 +142,11 @@ of this exercise.
137142
state: present
138143
```
139144

140-
* These three lines are calling the Ansible module **`win_feature`** to
141-
install the IIS Web Server. [Click
145+
* These lines are calling the Ansible module **`win_feature`** to
146+
install the IIS Web Server, followed by a conditional reboot task.
147+
The `register` keyword captures the result of the feature installation,
148+
and the `win_reboot` module will only run if the installation requires
149+
a system restart. [Click
142150
here](https://docs.ansible.com/ansible/latest/collections/ansible/windows/win_feature_module.html)
143151
to see all options for the `win_feature` module.
144152

@@ -251,6 +259,11 @@ You are ready to automate!
251259
ansible.windows.win_feature:
252260
name: Web-Server
253261
state: present
262+
register: win_feature
263+
264+
- name: Reboot if installing Web-Server feature requires it
265+
ansible.windows.win_reboot:
266+
when: win_feature.reboot_required
254267
255268
- name: Start iis service
256269
ansible.windows.win_service:

exercises/ansible_windows/3-playbook/install_iis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
ansible.windows.win_feature:
88
name: Web-Server
99
state: present
10+
register: win_feature
11+
12+
- name: Reboot if installing Web-Server feature requires it
13+
ansible.windows.win_reboot:
14+
when: win_feature.reboot_required
1015

1116
- name: Start iis service
1217
ansible.windows.win_service:

0 commit comments

Comments
 (0)