Added Windows templates (#1)

add windows demos
This commit is contained in:
MKletz
2022-02-15 13:21:10 -06:00
committed by GitHub
parent b1ce718762
commit 6412c17e51
7 changed files with 192 additions and 3 deletions

25
windows/install_iis.yml Normal file
View File

@@ -0,0 +1,25 @@
---
- name: Install IIS
hosts: "{{ HOSTS | default('windows') }}"
vars:
iis_message: undef
tasks:
- name: Install IIS
win_feature:
name: Web-Server
state: present
- name: Start IIS service
win_service:
name: W3Svc
state: started
- name: Create website index.html
win_copy:
content: "{{ iis_message }}"
dest: C:\Inetpub\wwwroot\index.html
- name: Show website address
debug:
msg: http://{{ ansible_host }}

116
windows/setup.yml Normal file
View File

@@ -0,0 +1,116 @@
---
controller_components:
- projects
- job_templates
controller_projects:
- name: Fact Scan
organization: Default
scm_type: git
scm_url: 'https://github.com/ansible/awx-facts-playbooks.git'
controller_templates:
- name: "WINDOWS / Install IIS"
job_type: run
inventory: "Workshop Inventory"
project: "Ansible official demo project"
playbook: "windows/install_iis.yml"
execution_environment: Default execution environment
credentials:
- "Workshop Credential"
survey_enabled: true
survey:
name: ''
description: ''
spec:
- question_name: Server Name or Pattern
type: text
variable: HOSTS
required: false
- question_name: web content
type: text
variable: iis_message
required: true
- name: "WINDOWS / Windows updates"
job_type: run
inventory: "Workshop Inventory"
project: "Ansible official demo project"
playbook: "windows/windows_updates.yml"
execution_environment: Default execution environment
credentials:
- "Workshop Credential"
survey_enabled: true
survey:
name: ''
description: ''
spec:
- question_name: Server Name or Pattern
type: text
variable: HOSTS
required: false
- question_name: Update categories
type: multiplechoice
variable: categories
required: false
default: SecurityUpdates
choices:
- Application
- Connectors
- CriticalUpdates
- DefinitionUpdates
- DeveloperKits
- FeaturePacks Guidance
- SecurityUpdates
- ServicePacks
- Tools
- UpdateRollups
- Updates
- question_name: Reboot after install?
type: multiplechoice
variable: reboot_server
required: false
default: 'Yes'
choices:
- 'Yes'
- 'No'
- name: "WINDOWS / Chocolatey install multiple"
job_type: run
inventory: "Workshop Inventory"
project: "Ansible official demo project"
playbook: "windows/windows_choco_multiple.yml"
execution_environment: Default execution environment
credentials:
- "Workshop Credential"
survey_enabled: true
survey:
name: ''
description: ''
spec:
- question_name: Server Name or Pattern
type: text
variable: HOSTS
required: false
- name: "WINDOWS / Chocolatey install specific"
job_type: run
inventory: "Workshop Inventory"
project: "Ansible official demo project"
playbook: "windows/windows_choco_specific.yml"
execution_environment: Default execution environment
credentials:
- "Workshop Credential"
survey_enabled: true
survey:
name: ''
description: ''
spec:
- question_name: Server Name or Pattern
type: text
variable: HOSTS
required: false
- question_name: Package name
type: text
variable: package_name
required: true

View File

@@ -0,0 +1,29 @@
---
- name: Chocolatey install multiple
hosts: "{{ HOSTS | default('windows') }}"
gather_facts: false
vars:
choco_packages:
- name: nodejs
version: 13.0.0
- name: python
version: 3.6.0
tasks:
- name: Install specific versions of packages sequentially
win_chocolatey:
name: "{{ item.name }}"
version: "{{ item.version }}"
loop: "{{ choco_packages }}"
- name: Check python version
win_command: python --version
register: check_python_version
changed_when: false
- name: Check nodejs version
win_command: node --version
register: check_node_version
changed_when: false
- debug:
msg: Python Version is {{ check_python_version.stdout_lines[0] }} and NodeJS version is {{ check_node_version.stdout_lines[0] }}

View File

@@ -0,0 +1,9 @@
---
- name: Chocolatey install specific
hosts: "{{ HOSTS | default('windows') }}"
gather_facts: false
tasks:
- name: Install choco package with specific version
win_chocolatey:
name: "{{ package_name }}"

View File

@@ -0,0 +1,9 @@
---
- name: Windows updates
hosts: "{{ HOSTS | default('windows') }}"
tasks:
- name: Install Windows Updates
win_updates:
category_names: "{{ categories | default(omit) }}"
reboot: '{{ reboot_server | default(yes) }}'