Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
miteshget committed Sep 17, 2024
1 parent 56af4ce commit 44555e8
Show file tree
Hide file tree
Showing 24 changed files with 1,394 additions and 0 deletions.
Binary file added images/ac_jobs.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/ac_login.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/demo_access_details.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/eda_demo_info_page.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/eda_login.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/eda_rulebook_activations.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/eda_rulebook_activations_v2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/eda_trigger_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/eda_trigger_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/eda_trigger_3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/eda_vscode_terminal.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/event_driven_ansible_architecture.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/oc_login_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/oc_login_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/rq_ac_job.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/rq_create.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/rq_eda_logs.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/rq_podman.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/user_info.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/vscode_login.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/vscode_login_terminal.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/vscode_login_terminal_split.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
346 changes: 346 additions & 0 deletions pages/event-driven-ansible-with-openshift.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,346 @@
[.text-justify]
= Narrative: Event Driven Ansible with OpenShift
:imagesdir: ../images
:numbered:
:toc:



== Demo Platform (demo.redhat.com)

=== Catalog Item
* link:https://demo.redhat.com/catalog?search=event+driven&item=babylon-catalog-prod%2Fenterprise.event-driven-ansible.prod[Launch the Demo by accessing the Catalog Item in RHDP]

=== Demo Access
Upon ordering the demo environment, you will gain comprehensive access to a fully-fledged interface that hosts all the systems you can utilize. Pay close attention to how specific values populate as your new environment activates and transitions to operational status. Here is an illustrative example for your reference:


image::demo_access_details.png[Access Details, 60%]

== Event-Driven Ansible

=== Demo Introduction

In this demo, we're showcasing the adaptability and effectiveness of Event-Driven Ansible. While we are utilizing Red Hat OpenShift events as a trigger, remember to highlight that this tool's capabilities aren't limited to just OpenShift - it's designed to work effectively with any operational ecosystem your customer may have.

Showcase how Event-Driven Ansible can use events to initiate actions, demonstrating its ability to turn any event into an opportunity for intelligent automation. This isn't just automation; it's an efficient, event-driven response system that's compatible with any operational ecosystem.

Use real-world examples to illustrate how this tool can enhance their processes, making them more efficient, faster, and responsive. By the end of this demonstration, your customers should understand the competitive advantage and agility that adopting Event-Driven Ansible can bring to their operations in today's rapidly evolving digital landscape.


=== The Power of Event-Driven Ansible
Event-Driven Ansible offers an amalgamation of Ansible's versatility and the principles of event-driven architecture, making it a significant asset for any operational ecosystem.

In this demo, you will discover how Event-Driven Ansible can manage not just application deployments and scaling operations but also be utilized for daily tasks and swift troubleshooting. This platform efficiently transforms automation into a quick, proactive response mechanism across the entire ecosystem, which is tailored for your customer's specific business needs.

By leveraging Event-Driven Ansible, you can significantly enhance your customer's infrastructure recovery time. Whenever an issue arises, the system automatically triggers a predefined response, reducing the time spent manually diagnosing and resolving the problem. This automation not only speeds up recovery but also minimizes the risk of human error during the troubleshooting process.

Additionally, Event-Driven Ansible also helps streamline and automate routine tasks. This allows your customer to focus on strategic initiatives rather than getting bogged down in day-to-day operations. Tasks like system updates, user management, and routine maintenance can be automated, saving valuable time and resources.

During the demonstration, you'll provide a clear understanding of how Event-Driven Ansible helps achieve efficient, intelligent, and responsive automation. This not only helps in rapid issue resolution and infrastructure recovery but also in efficiently managing daily operations. By showcasing these capabilities, you can highlight the extensive benefits and potential applications of Event-Driven Ansible in their organization, thereby enhancing their operational efficiency and productivity.

=== Source Page
* link:https://source.redhat.com/groups/public/rhdp/rhdp_catalog_items/catalog_items_wiki/event_driven_ansible_with_openshift_demo[Click to Access Event-driven Ansible with OpenShift Demo Source Page]


== Understanding Rulebooks

=== The Backbone of Event Driven Ansible
Central to our demonstration today are *'Rulebooks.'* In the context of Event-Driven Ansible, a rulebook defines the guidelines that Ansible should follow in response to particular events or conditions.

A rulebook is our strategic playbook, constituted of three fundamental components:

* *Sources:* The starting point of our automation journey, sources determine the event source we're utilizing. These are drawn from a plethora of source plugins, crafted to cater to a variety of use cases. As we continue to expand our portfolio, more sources will become available. As of now, we have several ready-to-use plugins, including webhooks, Kafka, Azure service bus, file changes, and alertmanager.

* *Rules:* Acting as the decision makers, rules set the conditions we're looking for within the chosen event source. If a condition is met, it can trigger a subsequent action, forming a critical link in our automation chain.

* *Actions:* The culmination of our process, actions decide what should transpire once a condition is fulfilled. A variety of actions are currently available, such as run_playbook, run_module, set_fact, post_event, and debug.

This rulebook, therefore, provides a comprehensive, customizable, and extensible blueprint for your automation processes, ensuring we cover the full spectrum from event sources to reactive actions.

=== The Business Benefits of Event-Driven Ansible
In the course of this demo, we will delve into the manifold business benefits you can achieve by implementing Event-Driven Ansible:

*Real-Time Responsiveness:* Automate responses to events, leading to quicker issue resolution and optimized resource utilization.

* *Increased Efficiency:* Reduce manual tasks, minimize errors, and bolster operational productivity.

* *Scalability and Flexibility:* Expand your automation capabilities in sync with your infrastructure, enabling a seamless adaptation to changing environments.

* *Intelligent Automation:* Utilize event data to make informed decisions, thereby optimizing resource usage.

* *Enhanced Reliability:* Ensure consistent and accurate task execution, thus reducing risks associated with human error.

* *Improved Compliance and Governance:* Enforce standards, track automated actions, and demonstrate compliance.

* *Rapid Innovation and Time-to-Market:* Accelerate service delivery and application deployment to respond more swiftly to market trends.

Integration with Existing Systems: Seamlessly integrate with your existing tools, systems, and APIs.

=== Conclusion: The Transformative Potential of Event-Driven Ansible

In this demonstration, you will see how Event-Driven Ansible serves as a catalyst, unlocking unprecedented levels of automation that boost efficiency, scalability, and reliability across any operational environment. So, gear up for a deep dive into the next generation of automation technology.

== Architecture

=== High Level Infrastructure Architecture

image::event_driven_ansible_architecture.jpg[Event-Driven Ansible Architecture, 50%]


=== Say Do

.Trigger Events
[width=100%,cols="^.5%,30%a,65%a",options="header"]
|====
| SR No ^.^| Say ^.^| Do

|{counter:srn}|
[.text-justify]
In order to show demo, We need to open couple of browser tabs for-

* Vscode server
* Automation Controller
* EDA Controller
* [Optional] OpenShift Console

[.text-justify]
*demo.redhat.com* Info page contains all of the access details.

|*Action:*
[.text-justify]
. Go to the info page click on VScode server link, use password provided in the table to login.

+
image:vscode_login.jpg[VScode Login page, 95%]

. Go to info page click on Automation controller link, use username and password provided in the table to login.

+
NOTE: Sometimes copying and pasting the password may not work. If you're unable to log in, try typing the password manually, character by character, as this might resolve the issue.

+
image:ac_login.jpg[Automation Controller Login page, 95%]

. Go to info page click on Technology Preview - Event-driven Ansible Controller link, use username and password provided in the table to login.
+
image:eda_login.jpg[Event-Driven Ansible Controller Login page, 95%]

. [Optionally] Go to info page click on OpenShift Console link, use username and password provided in the table to login.
+
.Click htpasswd_provider
image:oc_login_1.jpg[OpenShift Login page, 95%]
+
.Login
image:oc_login_2.jpg[OpenShift Login page, 95%]



|{counter:srn}|
[.text-justify]
Prepare Automation controller to watch event triggered
|*Action:*
[.text-justify]
. Go to the Automation controller console and click on jobs under Views. Jobs section will show all triggered job templates status by the EDA.
+
image:ac_jobs.jpg[Automation Controller Jobs, 95%]




|{counter:srn}|
[.text-justify]
Prepare EDA controller to watch Rulebook Activations and logs
|*Action:*
[.text-justify]
. Go to the EDA Controller console and click on Rulebook Activations under Views. The Rulebook Activations section shows all Rulebook Activations.
+
image:eda_rulebook_activations_v2.png[Event-Driven Ansible Controller Rulebooks, 95%]


|{counter:srn}|
[.text-justify]
Prepare VScode server console to create openshift resources and trigger Event-driven Ansible rulebooks.

|*Action:*
[.text-justify]
. Go back to the VScode server console and open a terminal.
+
image:vscode_login_terminal.jpg[VScode terminal, 95%]

|{counter:srn}|
[.text-justify]
In order to trigger a set resource quota on a new namespace (rocketchat) by Event-driven ansible event.

[.text-justify]
We goto integrated terminal of vscode server then change to test-events directory. This directory contains three yaml files which contain OpenShift object definition.

[.text-justify]
To trigger set resource quota, we run oc command with 1-test-resource-quota-on-namespace.yml file which creates rocketchat namespace in OpenShift.

[.text-justify]
New namespace creation will eventually trigger a set resource quota event. As an action for the event it will set resource quota on created rocketchat namespace.

[.text-justify]
To observe, we can check EDA controller Rulebook Activate history and automation controller jobs.

[.text-justify]
To verify the changes run OpenShift oc command line to check resource quota on created rocketchat namespace.

|*Action:*
[.text-justify]
. Go to the vscode integrated terminal, Change the directory and run oc command to create namespace (rocketchat) which will eventually trigger the event.

+
[source,shell]
----
cd $HOME/demo/test-events/
oc create -f 1-test-resource-quota-on-namespace.yml
----

+
image:eda_vscode_terminal.jpg[VScode terminal, 100%]

*Observe:*
[.text-justify]
. Observe EDA Controller Set Resource Quota On Namespace Rulebook Activation has caught the event for new namespace and triggered the action.



. Click on Set Resource Quota on Namespace Rulebook Activation.
+
image:eda_trigger_1.jpg[Rulebook Trigger, 95%]

. Click on History.

+
image:eda_trigger_2.jpg[Rulebook Trigger, 95%]

. Now click on Set Resource Quota on Namespace to view the EDA event logs.
+
image:eda_trigger_3.jpg[Rulebook Trigger, 95%]

. Observe the Automation controller has a new job running.
+
image:rq_ac_job.jpg[Automation Controller Job, 95%]


. Observe that the new namespace (rocketchat) has a quota set. Run the following command on the second terminal.

+
[source,shell]
----
oc get resourcequota -n rocketchat
----



|{counter:srn}|
[.text-justify]
In order to trigger a create volume snapshot of newly added pvc by Event-driven ansible event.

[.text-justify]
We go to the second terminal and make sure we are still in the test-events directory which contains three yaml files of OpenShift object definition.

[.text-justify]
To trigger the create volume snapshot, we run oc command with 2-test-volume-snapshot.yml file which creates rocketchat app, database and persistent volume claim in rocketchat namespace.

[.text-justify]
New persistent volume claim creation will eventually trigger a create volume snapshot event. As an action for the event it will create a snapshot of the persistentvolumeclaim in the rocketchat namespace.

[.text-justify]
To observe, we can check EDA controller Rulebook Activate history and automation controller jobs.

[.text-justify]
To verify the changes run OpenShift oc command to get the volume snapshot list in rocketchat namespace.

|*Action:*
[.text-justify]
. Go to the VScode terminal, Change the directory and run oc command to create the rocketchat application in the rocketchat namespace which will eventually trigger the event.
+
[source,shell]
----
cd $HOME/demo/test-events/
oc create -f 2-test-volume-snapshot.yml
----


*Observe:*
[.text-justify]
. Observe EDA Controller Create Volume Snapshot Rulebook Activation has caught the event for new persistentvolumeclaim which triggered the action.

. Observe the Automation controller has a new job running.

. Observe that the new persistentvolumeclaim has a screenshot in rocketchat namespace. Run the following command on the second terminal.
+
[source,shell]
----
oc get volumesnapshot -n rocketchat
----


|{counter:srn}|

[.text-justify]
In order to trigger a patch route of newly added route by Event-driven ansible event.
[.text-justify]
We go to the second terminal and make sure we are still in the test-events directory which contains three yaml files of OpenShift object definition.
[.text-justify]
To trigger the patch route, we run oc command with 3-test-route-with-cert.yml file which creates route for rocketchat app in rocketchat namespace.
[.text-justify]
New route creation will eventually trigger a patch route event. As an action for the event it will patch the route with a signed certificate in the rocketchat namespace.
[.text-justify]
To observe, we can check EDA controller Rulebook Activate history and automation controller jobs.

[.text-justify]
To verify the changes run OpenShift oc command to get the route in rocketchat namespace.


|*Action:*
[.text-justify]
. Go to the VScode terminal, Change the directory and run oc command to create the route for rocketchat application in the rocketchat namespace which will eventually trigger the event.

+
[source,shell]
----
cd $HOME/demo/test-events/
oc create -f 3-test-route-with-cert.yml
----


*Observe:*
[.text-justify]
. Observe EDA Controller Patch Route With Cert Rulebook Activation has caught the event for the new route and triggered the action.

. Observe the Automation controller has a new job running.

. Observe that the new route has been patched with a certificate. Run the following command on the second terminal.

+
[source,shell]
----
oc get route -n rocketchat -o yaml \| grep cert-manager
----


|====


== Troubleshooting

=== Source Code
* Rulebook/Playbook Repository
** link:https://github.com/redhat-gpte-devopsautomation/demo-event-driven-ansible[Event Driven Ansible Provision Repository]

* Custom Event-Driven Plugin
** link:https://github.com/sabre1041/sabre1041.eda[sabre1041.eda.k8s]

* Decision Environment
** link:https://github.com/miteshget/eda-de[Build Custom Decision Environment (DE)]

=== Help & Support
* Slack Channel
** link:https://app.slack.com/client/E030G10V24F/C07M6BWRQCF[#event-driven-ansible-with-openshift-demo]



Loading

0 comments on commit 44555e8

Please sign in to comment.