-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from p3ck/services_experience
Configure Windows Services
- Loading branch information
Showing
10 changed files
with
172 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
context/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Build EE manually, push to quay.io | ||
|
||
``` | ||
ansible-builder build | ||
# podman build -f context/Containerfile -t ansible-execution-env:latest context | ||
podman tag ansible-execution-env:latest quay.io/p3ck/apd-ee-25-experience:latest | ||
podman push quay.io/p3ck/apd-ee-25-experience:latest | ||
``` |
13 changes: 13 additions & 0 deletions
13
extensions/patterns/manage_service/exec_env/execution-environment.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
version: 3 | ||
images: | ||
base_image: | ||
name: quay.io/ansible-product-demos/apd-ee-25:latest | ||
dependencies: | ||
galaxy: requirements.yml | ||
ansible_core: | ||
package_pip: ansible-core | ||
ansible_runner: | ||
package_pip: ansible-runner | ||
system: | ||
- podman |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
collections: | ||
# - name: ansible.experience_demo | ||
- name: https://github.com/redhat-cop/infra.windows_ops.git | ||
type: git | ||
version: main |
13 changes: 13 additions & 0 deletions
13
extensions/patterns/manage_service/playbooks/run_manage_service.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
- name: Manage Windows Services | ||
hosts: all | ||
gather_facts: false | ||
tasks: | ||
- name: Manage Windows Service | ||
ansible.builtin.include_role: | ||
name: infra.windows_ops.windows_manage_service | ||
vars: | ||
windows_manage_service_name: "{{ service_name }}" # Set by survey | ||
windows_manage_service_state: "{{ service_state }}" # Set by survey | ||
windows_manage_service_start_mode: "{{ service_start_mode }}" # Set by survey | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
# Labels | ||
# | ||
controller_labels: | ||
- name: infra.windows_ops | ||
organization: "{{ organization | default('Default') }}" | ||
- name: manage_service_pattern | ||
organization: "{{ organization | default('Default') }}" | ||
- name: run_manage_service | ||
organization: "{{ organization | default('Default') }}" | ||
|
||
# Execution Environments | ||
# | ||
controller_execution_environments: | ||
- name: apd-ee-25-windows | ||
description: Allow running Windows experience demo. Based on apd-ee-25. | ||
image: quay.io/p3ck/apd-ee-25-experience:latest | ||
pull: always | ||
|
||
# Projects | ||
# | ||
controller_projects: | ||
- name: Windows Operations / Project | ||
organization: Default | ||
scm_branch: main | ||
scm_clean: 'no' | ||
scm_delete_on_update: 'no' | ||
scm_type: git | ||
scm_update_on_launch: 'yes' | ||
scm_url: https://github.com/redhat-cop/infra.windows_ops.git | ||
|
||
|
||
# Job Templates | ||
# | ||
controller_templates: | ||
- name: Windows Operations / Manage Service | ||
ask_inventory_on_launch: true | ||
labels: | ||
- infra.windows_ops | ||
- manage_service_pattern | ||
- run_manage_service | ||
playbook: "extensions/patterns/manage_service/playbooks/run_manage_service.yml' }}" | ||
project: Windows Operations / Project | ||
survey_enabled: true | ||
survey_spec: "{{ lookup('file', pattern.path.replace('setup.yml', '') + 'template_surveys/manage_service.yml') | from_yaml }}" | ||
ask_credential_on_launch: true | ||
execution_environment: apd-ee-25-windows |
33 changes: 33 additions & 0 deletions
33
extensions/patterns/manage_service/template_surveys/manage_services.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
name: "Manage Service Configuration Survey" | ||
description: "Survey to configure manage service options" | ||
spec: | ||
- question_name: "Service Name" | ||
question_description: "Specify the Windows Service you would like to manage" | ||
required: true | ||
variable: "service_name" | ||
type: "text" | ||
|
||
- question_name: "Service State" | ||
question_description: "Specify the state of the Service" | ||
required: true | ||
variable: "service_state" | ||
type: "multiplechoice" | ||
choices: | ||
- "absent" | ||
- "paused" | ||
- "started" | ||
- "stopped" | ||
- "restarted" | ||
|
||
- question_name: "Start mode" | ||
question_description: "Set the startup mode for the Service" | ||
required: false | ||
variable: "service_start_mode" | ||
type: "multplechoice" | ||
choices: | ||
- "auto" | ||
- "delayed" | ||
- "disabled" | ||
- "manual" | ||
default: "auto" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
windows_manage_service_start_mode: "auto" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
argument_specs: | ||
main: | ||
version_added: 1.0.0 | ||
short_description: A role to Manage Windows Services. | ||
description: | ||
- A role to Manage Windows Services. | ||
options: | ||
windows_manage_service_name: | ||
type: str | ||
description: The name of the service. | ||
required: true | ||
windows_manage_service_state: | ||
type: str | ||
choices: | ||
- "absent" | ||
- "paused" | ||
- "started" | ||
- "stopped" | ||
- "restarted" | ||
required: true | ||
description: The state of the service. | ||
windows_manage_service_start_mode: | ||
type: str | ||
choices: | ||
- "auto" | ||
- "delayed" | ||
- "disabled" | ||
- "manual" | ||
default: "auto" | ||
description: The start mode of the service. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
# tasks file for windows_manage_service | ||
|
||
- name: Manage Windows Service | ||
ansible.windows.win_service: | ||
name: "{{ windows_manage_service_name }}" | ||
state: "{{ windows_manage_service_state }}" | ||
start_mode: "{{ windows_manage_service_start_mode }}" | ||
|
||
- name: Check Win Service | ||
ansible.windows.win_service_info: | ||
name: "{{ windows_manage_service_name }}" | ||
register: windows_manage_service_status | ||
|
||
- name: Display Win Service | ||
ansible.builtin.debug: | ||
var: windows_manage_service_status | ||
... |