Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ansible/ansible-examples.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Johnson <dave@ansibleworks.com>2014-08-21 18:01:50 +0400
committerDave Johnson <dave@ansibleworks.com>2014-08-21 18:01:50 +0400
commit7296ce5304b7e91adf256589a0992d8762b7a6d1 (patch)
tree921700704b5cf194520081d031c3f65c3767f001
parentbd5dcf41ff845fde984579d12de6788c10de5a7a (diff)
Added test playbooks for Windows
-rw-r--r--windows/deploy-site.yml11
-rw-r--r--windows/enable-iis.yml14
-rw-r--r--windows/files/helloworld.ps15
-rw-r--r--windows/ping.yml9
-rw-r--r--windows/run-powershell.yml9
-rw-r--r--windows/test.yml36
6 files changed, 84 insertions, 0 deletions
diff --git a/windows/deploy-site.yml b/windows/deploy-site.yml
new file mode 100644
index 0000000..70114f6
--- /dev/null
+++ b/windows/deploy-site.yml
@@ -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'
diff --git a/windows/enable-iis.yml b/windows/enable-iis.yml
new file mode 100644
index 0000000..bc48aa3
--- /dev/null
+++ b/windows/enable-iis.yml
@@ -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
diff --git a/windows/files/helloworld.ps1 b/windows/files/helloworld.ps1
new file mode 100644
index 0000000..b7f785d
--- /dev/null
+++ b/windows/files/helloworld.ps1
@@ -0,0 +1,5 @@
+# Filename: helloworld.ps1
+Write-Host
+Write-Host 'Hello World!'
+Write-Host "Good-bye World! `n"
+# end of script
diff --git a/windows/ping.yml b/windows/ping.yml
new file mode 100644
index 0000000..15cba8d
--- /dev/null
+++ b/windows/ping.yml
@@ -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:
+
diff --git a/windows/run-powershell.yml b/windows/run-powershell.yml
new file mode 100644
index 0000000..4e1efc9
--- /dev/null
+++ b/windows/run-powershell.yml
@@ -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
diff --git a/windows/test.yml b/windows/test.yml
new file mode 100644
index 0000000..b347a6f
--- /dev/null
+++ b/windows/test.yml
@@ -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"