commit
ab8aa27eb9
@ -0,0 +1,11 @@ |
||||
--- |
||||
# This playbook uses the win_get_url module to download a simple HTML file for IIS |
||||
|
||||
- name: Download simple web site |
||||
hosts: windows |
||||
gather_facts: false |
||||
tasks: |
||||
- name: Download simple web site to 'C:\inetpub\wwwroot\ansible.html' |
||||
win_get_url: |
||||
url: 'https://raw.githubusercontent.com/thisdavejohnson/mywebapp/master/index.html' |
||||
dest: 'C:\inetpub\wwwroot\ansible.html' |
@ -0,0 +1,14 @@ |
||||
--- |
||||
# This playbook installs and enables IIS on Windows hosts |
||||
|
||||
- name: Install IIS |
||||
hosts: all |
||||
gather_facts: false |
||||
tasks: |
||||
- name: Install IIS |
||||
win_feature: |
||||
name: "Web-Server" |
||||
state: present |
||||
restart: yes |
||||
include_sub_features: yes |
||||
include_management_tools: yes |
@ -0,0 +1,5 @@ |
||||
# Filename: helloworld.ps1 |
||||
Write-Host |
||||
Write-Host 'Hello World!' |
||||
Write-Host "Good-bye World! `n" |
||||
# end of script |
@ -0,0 +1,9 @@ |
||||
--- |
||||
# This playbook uses the win_ping module to test connectivity to Windows hosts |
||||
- name: Ping |
||||
hosts: windows |
||||
|
||||
tasks: |
||||
- name: ping |
||||
win_ping: |
||||
|
@ -0,0 +1,9 @@ |
||||
--- |
||||
# This playbook tests the script module on Windows hosts |
||||
|
||||
- name: Run powershell script |
||||
hosts: windows |
||||
gather_facts: false |
||||
tasks: |
||||
- name: Run powershell script |
||||
script: files/helloworld.ps1 |
@ -0,0 +1,36 @@ |
||||
--- |
||||
# This playbook uses various Windows modules to test their functionality |
||||
|
||||
- name: test raw module |
||||
hosts: windows |
||||
tasks: |
||||
- name: run ipconfig |
||||
raw: ipconfig |
||||
register: ipconfig |
||||
- debug: var=ipconfig |
||||
|
||||
- name: test stat module |
||||
hosts: windows |
||||
tasks: |
||||
- name: test stat module on file |
||||
win_stat: path="C:/Windows/win.ini" |
||||
register: stat_file |
||||
|
||||
- debug: var=stat_file |
||||
|
||||
- name: check stat_file result |
||||
assert: |
||||
that: |
||||
- "stat_file.stat.exists" |
||||
- "not stat_file.stat.isdir" |
||||
- "stat_file.stat.size > 0" |
||||
- "stat_file.stat.md5" |
||||
|
||||
- name: Add a user |
||||
hosts: all |
||||
gather_facts: false |
||||
tasks: |
||||
- name: Add User |
||||
win_user: |
||||
name: ansible |
||||
password: "@ns1bl3" |
Reference in new issue