From 063ce9f83ec2226a0547d1907ae49eb92a47c494 Mon Sep 17 00:00:00 2001 From: Bill Peck Date: Thu, 21 Nov 2024 13:40:18 -0500 Subject: [PATCH] Add experience for Windows IIS This experience is for deploying Windows IIS Server. Include the execution environment to run against and how to build it manually for now. Update to use proper repo and branch. --- .../create_iis/exec_env/.gitignore | 1 + .../experiences/create_iis/exec_env/README.md | 8 +++ .../exec_env/execution_environment.yml | 13 +++++ .../create_iis/exec_env/requirements.yml | 6 +++ .../create_iis/playbooks/run_create_iis.yml | 22 +++++++++ extensions/experiences/create_iis/setup.yml | 49 +++++++++++++++++++ .../template_surveys/create_iis.yml | 29 +++++++++++ .../delete_iis/exec_env/.gitignore | 1 + .../experiences/delete_iis/exec_env/README.md | 8 +++ .../exec_env/execution_environment.yml | 13 +++++ .../delete_iis/exec_env/requirements.yml | 6 +++ .../delete_iis/playbooks/run_delete_iis.yml | 12 +++++ extensions/experiences/delete_iis/setup.yml | 49 +++++++++++++++++++ .../template_surveys/delete_iis.yml | 19 +++++++ 14 files changed, 236 insertions(+) create mode 100644 extensions/experiences/create_iis/exec_env/.gitignore create mode 100644 extensions/experiences/create_iis/exec_env/README.md create mode 100644 extensions/experiences/create_iis/exec_env/execution_environment.yml create mode 100644 extensions/experiences/create_iis/exec_env/requirements.yml create mode 100644 extensions/experiences/create_iis/playbooks/run_create_iis.yml create mode 100644 extensions/experiences/create_iis/setup.yml create mode 100644 extensions/experiences/create_iis/template_surveys/create_iis.yml create mode 100644 extensions/experiences/delete_iis/exec_env/.gitignore create mode 100644 extensions/experiences/delete_iis/exec_env/README.md create mode 100644 extensions/experiences/delete_iis/exec_env/execution_environment.yml create mode 100644 extensions/experiences/delete_iis/exec_env/requirements.yml create mode 100644 extensions/experiences/delete_iis/playbooks/run_delete_iis.yml create mode 100644 extensions/experiences/delete_iis/setup.yml create mode 100644 extensions/experiences/delete_iis/template_surveys/delete_iis.yml diff --git a/extensions/experiences/create_iis/exec_env/.gitignore b/extensions/experiences/create_iis/exec_env/.gitignore new file mode 100644 index 0000000..8fe9bbb --- /dev/null +++ b/extensions/experiences/create_iis/exec_env/.gitignore @@ -0,0 +1 @@ +context/** diff --git a/extensions/experiences/create_iis/exec_env/README.md b/extensions/experiences/create_iis/exec_env/README.md new file mode 100644 index 0000000..1e54544 --- /dev/null +++ b/extensions/experiences/create_iis/exec_env/README.md @@ -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 +``` diff --git a/extensions/experiences/create_iis/exec_env/execution_environment.yml b/extensions/experiences/create_iis/exec_env/execution_environment.yml new file mode 100644 index 0000000..241fae4 --- /dev/null +++ b/extensions/experiences/create_iis/exec_env/execution_environment.yml @@ -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 diff --git a/extensions/experiences/create_iis/exec_env/requirements.yml b/extensions/experiences/create_iis/exec_env/requirements.yml new file mode 100644 index 0000000..13b7c7a --- /dev/null +++ b/extensions/experiences/create_iis/exec_env/requirements.yml @@ -0,0 +1,6 @@ +--- +collections: + # - name: ansible.experience_demo + - name: https://github.com/redhat-cop/infra.windows_ops.git + type: git + version: iis_experience diff --git a/extensions/experiences/create_iis/playbooks/run_create_iis.yml b/extensions/experiences/create_iis/playbooks/run_create_iis.yml new file mode 100644 index 0000000..02d9261 --- /dev/null +++ b/extensions/experiences/create_iis/playbooks/run_create_iis.yml @@ -0,0 +1,22 @@ +--- +- name: Create IIS Server Play + hosts: all + gather_facts: false + tasks: + - name: Create default test message if not provided + ansible.builtin.set_fact: + test_message: "Welcome to IIS Web Server" + when: iis_test_message is not defined + + - name: Set Default vars + ansible.builtin.set_fact: + test_message_final: "{{ iis_test_message | default(test_message) }}" + + - name: Create IIS Server + ansible.builtin.include_role: + name: infra.windows_ops.windows_manage_iis + vars: + windows_manage_iis_name: "{{ iis_name }}" # Set by survey + windows_manage_iis_path: "{{ iis_path }}" # Set by survey + windows_manage_iis_port: "{{ iis_port }}" # Set by survey + windows_manage_iis_test_message: "{{ test_message_final }}" # Use conditional message diff --git a/extensions/experiences/create_iis/setup.yml b/extensions/experiences/create_iis/setup.yml new file mode 100644 index 0000000..33d38fd --- /dev/null +++ b/extensions/experiences/create_iis/setup.yml @@ -0,0 +1,49 @@ +--- +# Labels +# +controller_labels: + - name: infra.windows_ops + organization: "{{ organization | default('Default') }}" + - name: create_iis + organization: "{{ organization | default('Default') }}" + - name: run_create_iis + organization: "{{ organization | default('Default') }}" + +# Execution Environments +# +controller_execution_environments: + # - name: apd-ee-25 + # description: apd-ee-25 + # image: quay.io/ansible-product-demos/apd-ee-25 + # pull: always + - name: apd-ee-25-rhel + description: Allow running RHEL 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: 'no' + scm_url: https://github.com/redhat-cop/infra.windows_ops.git + + +# Job Templates +# +controller_templates: + - name: Windows Operations / Create IIS + ask_inventory_on_launch: true + labels: + - infra.windows_ops + - create_iis + - run_create_iis + playbook: extensions/experiences/create_iis/playbooks/run_create_iis.yml + project: Windows Ops PLaybooks Project + survey_enabled: true + survey_spec: "{{ lookup('file', experience.path.replace('setup.yml', '') + 'template_surveys/create_iis.yaml') | from_yaml }}" diff --git a/extensions/experiences/create_iis/template_surveys/create_iis.yml b/extensions/experiences/create_iis/template_surveys/create_iis.yml new file mode 100644 index 0000000..cbf6ab6 --- /dev/null +++ b/extensions/experiences/create_iis/template_surveys/create_iis.yml @@ -0,0 +1,29 @@ +--- +name: "Create IIS Configuration Survey" +description: "Survey to configure create IIS options" +spec: + - type: "text" + question_name: "Server Name" + question_description: "Name of the IIS Web Server" + variable: "iis_name" + required: true + + - type: "text" + question_name: "Server Path" + question_description: "Path to the root directory of the IIS Web Server" + variable: "iis_path" + required: true + + - type: "integer" + question_name: "Server Port" + question_description: "Network port to listen on" + variable: "iis_port" + required: true + default: "80" + + - type: "text" + question_name: "Test Message" + question_description: "Test Message to place in index.html" + variable: "iis_test_message" + required: false + default: "Welcome to IIS Web Server" diff --git a/extensions/experiences/delete_iis/exec_env/.gitignore b/extensions/experiences/delete_iis/exec_env/.gitignore new file mode 100644 index 0000000..8fe9bbb --- /dev/null +++ b/extensions/experiences/delete_iis/exec_env/.gitignore @@ -0,0 +1 @@ +context/** diff --git a/extensions/experiences/delete_iis/exec_env/README.md b/extensions/experiences/delete_iis/exec_env/README.md new file mode 100644 index 0000000..1e54544 --- /dev/null +++ b/extensions/experiences/delete_iis/exec_env/README.md @@ -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 +``` diff --git a/extensions/experiences/delete_iis/exec_env/execution_environment.yml b/extensions/experiences/delete_iis/exec_env/execution_environment.yml new file mode 100644 index 0000000..241fae4 --- /dev/null +++ b/extensions/experiences/delete_iis/exec_env/execution_environment.yml @@ -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 diff --git a/extensions/experiences/delete_iis/exec_env/requirements.yml b/extensions/experiences/delete_iis/exec_env/requirements.yml new file mode 100644 index 0000000..13b7c7a --- /dev/null +++ b/extensions/experiences/delete_iis/exec_env/requirements.yml @@ -0,0 +1,6 @@ +--- +collections: + # - name: ansible.experience_demo + - name: https://github.com/redhat-cop/infra.windows_ops.git + type: git + version: iis_experience diff --git a/extensions/experiences/delete_iis/playbooks/run_delete_iis.yml b/extensions/experiences/delete_iis/playbooks/run_delete_iis.yml new file mode 100644 index 0000000..9a3fbb4 --- /dev/null +++ b/extensions/experiences/delete_iis/playbooks/run_delete_iis.yml @@ -0,0 +1,12 @@ +--- +- name: Delete IIS Server Play + hosts: all + gather_facts: false + tasks: + - name: Delete IIS Server + ansible.builtin.include_role: + name: infra.windows_ops.windows_manage_iis + vars: + windows_manage_iis_name: "{{ iis_name }}" # Set by survey + windows_manage_iis_delete_option: "{{ iis_remove_all }}" # Set by survey + windows_manage_iis_operation: "delete" diff --git a/extensions/experiences/delete_iis/setup.yml b/extensions/experiences/delete_iis/setup.yml new file mode 100644 index 0000000..c7d10cc --- /dev/null +++ b/extensions/experiences/delete_iis/setup.yml @@ -0,0 +1,49 @@ +--- +# Labels +# +controller_labels: + - name: infra.windows_ops + organization: "{{ organization | default('Default') }}" + - name: delete_iis + organization: "{{ organization | default('Default') }}" + - name: run_delete_iis + organization: "{{ organization | default('Default') }}" + +# Execution Environments +# +controller_execution_environments: + # - name: apd-ee-25 + # description: apd-ee-25 + # image: quay.io/ansible-product-demos/apd-ee-25 + # pull: always + - name: apd-ee-25-rhel + description: Allow running RHEL 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: 'no' + scm_url: https://github.com/redhat-cop/infra.windows_ops.git + + +# Job Templates +# +controller_templates: + - name: Windows Operations / Delete IIS + ask_inventory_on_launch: true + labels: + - infra.windows_ops + - delete_iis + - run_delete_iis + playbook: extensions/experiences/create_iis/playbooks/run_delete_iis.yml + project: Windows Ops PLaybooks Project + survey_enabled: true + survey_spec: "{{ lookup('file', experience.path.replace('setup.yml', '') + 'template_surveys/delete_iis.yaml') | from_yaml }}" diff --git a/extensions/experiences/delete_iis/template_surveys/delete_iis.yml b/extensions/experiences/delete_iis/template_surveys/delete_iis.yml new file mode 100644 index 0000000..f286f18 --- /dev/null +++ b/extensions/experiences/delete_iis/template_surveys/delete_iis.yml @@ -0,0 +1,19 @@ +--- +name: "Delete IIS Configuration Survey" +description: "Survey to configure delete IIS options" +spec: + - type: "text" + question_name: "Server Name" + question_description: "Name of the IIS Web Server" + variable: "iis_name" + required: true + + - type: "multiplechoice" + question_name: "Remove Feature IIS" + question_description: "Select all to remove the IIS Service as well as the Web Server definition" + choices: + - "all" + - "server" + variable: "iis_remove_all" + default: "server" + required: false