mirror of
https://github.com/geerlingguy/ansible-role-apache
synced 2025-01-10 11:50:18 +01:00
Merge pull request #78 from thisdavejohnson/master
Added test playbooks for Windows
This commit is contained in:
commit
ab8aa27eb9
6 changed files with 84 additions and 0 deletions
11
windows/deploy-site.yml
Normal file
11
windows/deploy-site.yml
Normal file
|
@ -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'
|
14
windows/enable-iis.yml
Normal file
14
windows/enable-iis.yml
Normal file
|
@ -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
|
5
windows/files/helloworld.ps1
Normal file
5
windows/files/helloworld.ps1
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Filename: helloworld.ps1
|
||||
Write-Host
|
||||
Write-Host 'Hello World!'
|
||||
Write-Host "Good-bye World! `n"
|
||||
# end of script
|
9
windows/ping.yml
Normal file
9
windows/ping.yml
Normal file
|
@ -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:
|
||||
|
9
windows/run-powershell.yml
Normal file
9
windows/run-powershell.yml
Normal file
|
@ -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
|
36
windows/test.yml
Normal file
36
windows/test.yml
Normal file
|
@ -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"
|
Loading…
Reference in a new issue