-
Notifications
You must be signed in to change notification settings - Fork 8
/
tower-ansible-automating-windows.yml
63 lines (56 loc) · 1.56 KB
/
tower-ansible-automating-windows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
- name: Automating Windows with Red Hat Ansible
hosts: windows-servers
gather_facts: false
tasks:
- name: Add a Windows Admin User
win_user:
name: ansible
password: "Redhat1!"
state: present
groups:
- Administrators
register: user
- debug: var=user
- name: Install Telnet-Client Feature
win_feature:
name: "Telnet-Client"
state: present
restart: False
include_sub_features: True
include_management_tools: True
register: telnet
- debug: var=telnet
- name: Install IIS Web-Server with management tools
win_feature:
name: "Web-Server"
state: present
restart: True
include_sub_features: False
include_management_tools: True
register: iis
- debug: var=iis
- name: Copy JPG archive to c:\Users\Administrator\Downloads
win_copy:
src: files/neerdd.jpg
dest: c:\Users\Administrator\Downloads\nerd.jpg
register: file
- debug: var=file
- name: Run a PowerShell Script
script: files/helloworld.ps1
register: script
- debug: var=script
- name: Run ipconfig Command
raw: ipconfig
register: ipconfig
- debug: var=ipconfig
- name: Check Status of file win.ini
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"