Solution Addressing The Challenges

Addressing Challenge:

As an administrator, streamlining the integration of the ChatOps system with Event-Driven Ansible Architecture proves to be a seamless process. This integration offers a significant advantage for product managers, enabling them to effortlessly issue commands directly from the chat system. This functionality empowers product managers to swiftly trigger changes for specific categories, such as applying discounts or disabling a particular category on the online retail website.

Solution:

  1. Open Visual Studio Code to explore and gain a better understanding of the Ansible playbooks and Event-driven Ansible rulebooks utilized in the 'Solution Addressing The Challenges'.

    1. Find the login details for accessing Visual Studio Code below:

      1. Vscode Console Url: {codeserver_url}[window=_blank]

      2. Password: {codeserver_password}

        VScode
        Figure 1. VScode Login Page
    2. Navigate to the 'event-driven-ansible-and-chatops' directory, then expand the 'playbooks' directory. Click on 'chatops-action.yml' to explore the playbook, which will be used to create a job template in the Automation Controller. The template will be triggered by Event-driven Ansible, executing actions on a product when messages are posted by the product manager in RocketChat.

      VScode
      Figure 2. VScode Dashboard Page
    3. Head to the 'event-driven-ansible-and-chatops' directory, then expand the 'rulebooks' directory. Click on 'rocketchat-trigger.yml' to delve into the rulebook. This rulebook will be instrumental in creating a Rulebook activation in Event-driven Ansible. When messages are posted by the product manager in RocketChat, this activation will, in turn, trigger the Automation Controller job template.

      VScode
      Figure 3. VScode Dashboard Page
  2. Access the Automation Controller to create a Job Template that facilitates the execution of actions on products within the Smart Retail Application. This should be triggered by messages posted by the product manager in RocketChat. The necessary details are provided below:

    1. Find the login details for accessing Automation Controller below:

      You can skip the login process if you’re already signed in.
      1. Automation Controller: {aap_controller_web_url}[window=_blank]

      2. Username: {aap_controller_admin_user}

      3. Password: {aap_controller_admin_password}

    2. Navigate to Templates and proceed to create a new template with the following details:

      1. Name: chatops-action

      2. Job Type: Run

      3. Inventory: Demo Inventory

      4. Project: event-driven-ansible-and-chatops

      5. Playbook: playbooks/chatops-action.yml

      6. Credentials:

        1. Selected Category: OpenShift or Kubernetes API Bearer Token

        2. Select: OpenShift Credentials

      7. Variables: Select Checkbox: [x] Prompt on Launch

      8. Variables: Kindly copy and paste the provided variables into the YAML format below for ease of use and implementation.

        eda_chatops_retail_db_host: globex-db.globex.svc.cluster.local

        eda_chatops_retail_db_name: globex

        eda_chatops_retail_db_password: globex

        eda_chatops_retail_db_username: globex

        rocketchat_url: {rocketchat_url}

        rocketchat_auth_token: {rocketchat_auth_token}

        rocketchat_user_id: {rocketchat_user_id}

      9. Click Save button to save.

      Automation Controller
      Figure 4. Automation Controller Job Template Page
  3. Access Event-driven Ansible to configure Rulebook Activation, facilitating the automatic triggering of an Ansible Controller Job Template upon submitting feedback in the Smart Retail Application. Please refer to the details provided below:

    1. Find the login details for accessing Event-driven Ansible below:

      You can skip the login process if you’re already signed in.
      1. Event-driven Ansible: {eda_controller_web_url}[window=_blank]

      2. Username: {eda_controller_admin_user}

      3. Password: {eda_controller_admin_password}

    2. Navigate to Rulebook Activation and proceed to add a new rulebook following the details provided below:

      1. Name: rocketchat-trigger

      2. project: AI Based Smart Retail

      3. Rulebook: rocketchat-trigger.yml

      4. Decision environment: de-kafka-scram

      5. Restart policy: On failure

      6. Rulebook activation enabled?: Enabled

      7. Click Create rulebook activation to create rulebook

        Event-driven Ansible
        Figure 5. Event-driven Ansible Rulebook Activations Page
      Event-driven Ansible
      Figure 6. Event-driven Ansible Create Rulebook Activation Page
  4. Access the OpenShift Console to configure routing for the Event-driven Ansible rulebook activation created in the previous step. Refer to the details provided below:

    1. Find the login details for accessing Openshift Console below:

      1. Console URL: {openshift_console_url}[window=_blank]

      2. Username: {openshift_cluster_admin_username}

      3. Password: {openshift_cluster_admin_password}

        OpenShift
        Figure 7. OpenShift Console Login Page
      OpenShift
      Figure 8. OpenShift Console Login Page
    2. Navigate to the 'Networking' section, select 'Route,' change the project to aap, and then click on the 'Create Route' button to configure the Event-driven Ansible route.

      OpenShift
      Figure 9. OpenShift Route Page
    3. To set up an Event-driven Ansible route for the 'rocketchat-trigger' rulebook, follow the details provided below:

      1. Name: eda-trigger

      2. Service: activation-job-X-X-5000

      3. Target port: 5000 → 5000 (TCP)

      4. Click Create button to save.

      OpenShift
      Figure 10. OpenShift Route Page
    4. Copy the 'eda-trigger' route, which will serve as the webhook URL for use in RocketChat.

      OpenShift
      Figure 11. OpenShift Route Page
  5. Access RocketChat to establish a webhook for Event-driven Ansible, following the details provided below:

    1. Find the login details for accessing RocketChat below:

      Kindly log out and log back in as an admin if you are currently signed in. This will ensure that you have the appropriate access and privileges for the next steps
      1. RocketChat Url: {rocketchat_url}[window=_blank]

      2. Username: admin

      3. Password: {rocketchat_admin_password}

    2. Navigate to administration.

      RocketChat
      Figure 12. RocketChat Administration Page
    3. Navigate to the 'Integration' section, and click on the 'New Integration' button to create a webhook for outgoing messages.

      If nothing appears upon the initial click, try clicking on other links and then return to the 'Integration' section to refresh and display the content.
      RocketChat
      Figure 13. RocketChat Webhook Page
    4. Select Outgoing WebHook.

      RocketChat
      Figure 14. RocketChat Webhook Page
    5. Select Message Sent from drop down list.

      RocketChat
      Figure 15. RocketChat Webhook Page
    6. Please provide the following details:

      1. Enabled: True

      2. Name (optional): Event-driven Ansible and ChatOps

      3. Channel: #clothing,#utensils

      4. Trigger Words: update,continue,discontinue

      5. URLs: <Paste eda-trigger route created in openshift>

      6. Impersonate User: True

      7. Post as: admin

      8. Keep the remaining settings as default.

      9. Save your changes by clicking on the 'Save Changes' button in the upper right corner.

      RocketChat
      Figure 16. RocketChat Webhook Page

Summary:

As an administrator, seamlessly integrating the ChatOps system with Event-Driven Ansible Architecture proves advantageous for product managers. This streamlined process empowers them to issue commands directly from the chat system, enabling swift changes for specific categories, from applying discounts to disabling particular sections on the online retail website.

Let’s move forward to the next page where we’ll delve into the analysis of live messages and the timely execution of actions through ChatOps commands