File tree 6 files changed +84
-0
lines changed
6 files changed +84
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ # This playbook uses the win_get_url module to download a simple HTML file for IIS
3
+
4
+ - name : Download simple web site
5
+ hosts : windows
6
+ gather_facts : false
7
+ tasks :
8
+ - name : Download simple web site to 'C:\inetpub\wwwroot\ansible.html'
9
+ win_get_url :
10
+ url : ' https://raw.githubusercontent.com/thisdavejohnson/mywebapp/master/index.html'
11
+ dest : ' C:\inetpub\wwwroot\ansible.html'
Original file line number Diff line number Diff line change
1
+ ---
2
+ # This playbook installs and enables IIS on Windows hosts
3
+
4
+ - name : Install IIS
5
+ hosts : all
6
+ gather_facts : false
7
+ tasks :
8
+ - name : Install IIS
9
+ win_feature :
10
+ name : " Web-Server"
11
+ state : present
12
+ restart : yes
13
+ include_sub_features : yes
14
+ include_management_tools : yes
Original file line number Diff line number Diff line change
1
+ # Filename: helloworld.ps1
2
+ Write-Host
3
+ Write-Host ' Hello World!'
4
+ Write-Host " Good-bye World! `n "
5
+ # end of script
Original file line number Diff line number Diff line change
1
+ ---
2
+ # This playbook uses the win_ping module to test connectivity to Windows hosts
3
+ - name : Ping
4
+ hosts : windows
5
+
6
+ tasks :
7
+ - name : ping
8
+ win_ping :
9
+
Original file line number Diff line number Diff line change
1
+ ---
2
+ # This playbook tests the script module on Windows hosts
3
+
4
+ - name : Run powershell script
5
+ hosts : windows
6
+ gather_facts : false
7
+ tasks :
8
+ - name : Run powershell script
9
+ script : files/helloworld.ps1
Original file line number Diff line number Diff line change
1
+ ---
2
+ # This playbook uses various Windows modules to test their functionality
3
+
4
+ - name : test raw module
5
+ hosts : windows
6
+ tasks :
7
+ - name : run ipconfig
8
+ raw : ipconfig
9
+ register : ipconfig
10
+ - debug : var=ipconfig
11
+
12
+ - name : test stat module
13
+ hosts : windows
14
+ tasks :
15
+ - name : test stat module on file
16
+ win_stat : path="C:/Windows/win.ini"
17
+ register : stat_file
18
+
19
+ - debug : var=stat_file
20
+
21
+ - name : check stat_file result
22
+ assert :
23
+ that :
24
+ - " stat_file.stat.exists"
25
+ - " not stat_file.stat.isdir"
26
+ - " stat_file.stat.size > 0"
27
+ - " stat_file.stat.md5"
28
+
29
+ - name : Add a user
30
+ hosts : all
31
+ gather_facts : false
32
+ tasks :
33
+ - name : Add User
34
+ win_user :
35
+ name : ansible
36
+ password : " @ns1bl3"
You can’t perform that action at this time.
0 commit comments