田辺  亮介

田辺 亮介

1660969080

如何使用 Ansible 自動化在 Azure 上部署 JBoss EAP

本文演示瞭如何使用 Ansible 自動化在 Microsoft Azure 上部署 Red Hat JBoss Enterprise Application Platform (JBoss EAP)。目前,Red Hat 提供 JBoss EAP 的 Microsoft Azure Marketplace 產品,但它只能通過相對複雜的自帶訂閱 (BYOS) 模型獲得。本文使用 Ansible Collections for Azure 創建 Azure 資源,然後使用 Ansible Middleware 項目提供的 WildFly 服務部署 JBoss EAP。

只需 6 個簡單步驟即可部署 JBoss EAP

我們將使用 azure-eap-demo 作為本文的示例應用程序。使用這個應用程序,我們將在運行 Red Hat Enterprise Linux 的 Azure 虛擬機上自動化和部署 JBoss EAP 實例。

步驟 1. 先決條件設置

要運行示例應用程序,請滿足以下要求:

  • 具有活動訂閱的 Azure 帳戶。如果您沒有 Azure 訂閱, 請免費創建一個
  • JBoss EAP:您需要一個具有 JBoss EAP 的 Red Hat 訂閱管理權利的 Red Hat 帳戶。此權利允許您下載經過 Red Hat 測試和認證的 JBoss EAP 版本。如果您沒有 JBoss EAP 權利,請註冊免費的開發人員訂閱:Red Hat Developer Subscription for Individuals。註冊後,您可以在 Red Hat 客戶門戶中找到必要的憑據(池 ID)。
  • 控制器主機或本地機器上的以下軟件:
    • Ansible(2.9 或更高版本)
    • Python(3.9 或更高版本)
    • Python3 netaddr(使用 dnf 或 pip 獲得)
    • Azure 命令行界面 (CLI)
    • 將 azure-eap-demo 應用程序下載到本地計算機。

步驟 2. 安裝 WildFly 和其他組件

解壓azure-eap-demo應用程序後,切換到存儲庫的頂級目錄,然後運行以下命令:

$ ansible-galaxy collection install -r requirements.yml

我們正在使用 Azure 提供的動態清單。創建實例後,您可以使用以下命令查看清單:

$ ansible-inventory -i inventory/myazure_rm.yml --graph

第 3 步:為 Red Hat 門戶訪問創建憑據

您需要在 playbook 中提供憑據,以便它可以從 Red Hat 客戶門戶下載軟件。在變量中指定您的 Red Hat 帳戶名並在rhn_username變量中指定您的密碼rhn_password

此外,您必須在jboss_eap_rhn_id變量中指定 JBoss EAP 的 Red Hat Subscription Management 授權。這個變量允許你指定你想要安裝的 JBoss EAP(Red Hat 支持)的版本。或者,您可以從 Red Hat 客戶門戶下載並安裝 JBoss EAP ZIP 文件。

所有這些變量都可以存儲在一個 YAML 文件中,您可以在 Ansible playbook 中名為vars_files.

第 4 步:運行 Ansible 劇本

現在運行 Ansible playbook,在 create-demo-setup.yml 其中創建 Azure 資源並部署 JBoss EAP:

​​​​​​​$ ansible-playbook -e @rhn-creds.yml -i inventory/myazure_rm.yml -e
"ansible_ssh_user=rheluser ansible_ssh_private_key_file='provide_your_ssh_private_key'
hosts_group_name=eap wildfly_version=7.4 override_install_name=jboss-eap"
create-demo-setup.yml

作為 playbook 執行的一部分,將克隆azure-eap-demo存儲庫。create-demo-setup.yml文件包含:

- name: Create Azure VM
  hosts: localhost
  gather_facts: false
  connection: local
  vars:
   repo_url: "https://github.com/ansible-middleware/wildfly-cluster-demo.git"
   branch: main
  tasks:
   - name: Git checkout
     ansible.builtin.git:
       repo: "{{ repo_url }}"
       dest: "{{ playbook_dir }}/wildfly-cluster-demo"
       version: "{{ branch }}"
       single_branch: yes
       clone: yes
       update: yes

   - name: Create demo resources on azure.
     include_role:
       name: 'azure'
     vars:
       ssh_key_path: "{{ ssh_key | default(lookup('env', 'HOME') + '/.ssh/id_rsa.pub')}}"

   - meta: refresh_inventory
   - pause:
       minutes: 1

- name: Run wildfly-cluster-demo
  import_playbook: wildfly-cluster-demo/playbook.yml

該劇本創建應用程序所需的 Azure 資源,包括資源組、虛擬網絡、子網、安全組、網絡接口、運行 Red Hat Enterprise Linux 的三個虛擬機以及虛擬機的公共 IP 地址。

Azure 雲實例的所有默認參數都在安裝包中roles/azure/defaults/main.yml

最後,劇本部署 WildFly 集群演示。請參閱文章使用 Ansible 自動化和部署 JBoss EAP 集群以了解有關如何使用 WildFly 的更多信息。

步驟 5. 驗證 JBoss EAP 集群和應用程序的部署

一旦 playbook 成功完成,您可以通過登錄Azure 門戶來驗證 JBoss EAP 集群。在這裡,您將找到為支持 JBoss EAP 集群而創建的所有資源。登錄或 SSH 到任何創建的虛擬機,並確認 WildFly 服務正在運行且可訪問。或者,您可以運行wildfly-cluster-demovalidate.yml應用程序中提供的 playbook 來驗證配置。

步驟 6.清理 Azure 資源

要清理在 Azure 上創建的所有資源,請運行clean-demo-resources.ymlplaybook:

$ ansible-playbook clean-demo-resources.yml

內容clean-demo-resources.yml如下:

- name: Create Azure VM
  hosts: localhost
  connection: local
  tasks:
   - name: Create VM's on azure.
     include_role:
       name: 'azure'
     vars:
       action: destroy

destroy操作運行roles/azure/tasks/destroy.yml文件,其中包含:

---
- name: Remove a VM and all resources that were autocreated
  azure_rm_virtualmachine:
   resource_group: "{{ item.resourcegroup_name }}"
   name: "{{ item.name }}"
   remove_on_absent: all_autocreated
   state: absent
  loop: "{{ vm }}"

- name: Delete a resource group including resources it contains
  azure_rm_resourcegroup:
   name: "{{ item.name }}"
   force_delete_nonempty: yes
   state: absent
  loop: "{{ resource_groups }}"

playbook 移除所有虛擬機並刪除eap-cluster資源組下的所有資源。

Ansible 簡化了 Azure 上的部署

在本文中,我們演示了在 Microsoft Azure 上使用 Ansible 創建資源並使用 Ansible Middleware 項目中的工具部署 JBoss EAP 集群的分步過程。查看 ansible -middleware GitHub 組織和Ansible Middleware 網站中的其他集合和演示。

鏈接:https ://developers.redhat.com/articles/2022/08/17/how-ansible-simplifies-jboss-eap-deployment-azure

#redhat #aruze #jboss

What is GEEK

Buddha Community

如何使用 Ansible 自動化在 Azure 上部署 JBoss EAP
田辺  亮介

田辺 亮介

1660969080

如何使用 Ansible 自動化在 Azure 上部署 JBoss EAP

本文演示瞭如何使用 Ansible 自動化在 Microsoft Azure 上部署 Red Hat JBoss Enterprise Application Platform (JBoss EAP)。目前,Red Hat 提供 JBoss EAP 的 Microsoft Azure Marketplace 產品,但它只能通過相對複雜的自帶訂閱 (BYOS) 模型獲得。本文使用 Ansible Collections for Azure 創建 Azure 資源,然後使用 Ansible Middleware 項目提供的 WildFly 服務部署 JBoss EAP。

只需 6 個簡單步驟即可部署 JBoss EAP

我們將使用 azure-eap-demo 作為本文的示例應用程序。使用這個應用程序,我們將在運行 Red Hat Enterprise Linux 的 Azure 虛擬機上自動化和部署 JBoss EAP 實例。

步驟 1. 先決條件設置

要運行示例應用程序,請滿足以下要求:

  • 具有活動訂閱的 Azure 帳戶。如果您沒有 Azure 訂閱, 請免費創建一個
  • JBoss EAP:您需要一個具有 JBoss EAP 的 Red Hat 訂閱管理權利的 Red Hat 帳戶。此權利允許您下載經過 Red Hat 測試和認證的 JBoss EAP 版本。如果您沒有 JBoss EAP 權利,請註冊免費的開發人員訂閱:Red Hat Developer Subscription for Individuals。註冊後,您可以在 Red Hat 客戶門戶中找到必要的憑據(池 ID)。
  • 控制器主機或本地機器上的以下軟件:
    • Ansible(2.9 或更高版本)
    • Python(3.9 或更高版本)
    • Python3 netaddr(使用 dnf 或 pip 獲得)
    • Azure 命令行界面 (CLI)
    • 將 azure-eap-demo 應用程序下載到本地計算機。

步驟 2. 安裝 WildFly 和其他組件

解壓azure-eap-demo應用程序後,切換到存儲庫的頂級目錄,然後運行以下命令:

$ ansible-galaxy collection install -r requirements.yml

我們正在使用 Azure 提供的動態清單。創建實例後,您可以使用以下命令查看清單:

$ ansible-inventory -i inventory/myazure_rm.yml --graph

第 3 步:為 Red Hat 門戶訪問創建憑據

您需要在 playbook 中提供憑據,以便它可以從 Red Hat 客戶門戶下載軟件。在變量中指定您的 Red Hat 帳戶名並在rhn_username變量中指定您的密碼rhn_password

此外,您必須在jboss_eap_rhn_id變量中指定 JBoss EAP 的 Red Hat Subscription Management 授權。這個變量允許你指定你想要安裝的 JBoss EAP(Red Hat 支持)的版本。或者,您可以從 Red Hat 客戶門戶下載並安裝 JBoss EAP ZIP 文件。

所有這些變量都可以存儲在一個 YAML 文件中,您可以在 Ansible playbook 中名為vars_files.

第 4 步:運行 Ansible 劇本

現在運行 Ansible playbook,在 create-demo-setup.yml 其中創建 Azure 資源並部署 JBoss EAP:

​​​​​​​$ ansible-playbook -e @rhn-creds.yml -i inventory/myazure_rm.yml -e
"ansible_ssh_user=rheluser ansible_ssh_private_key_file='provide_your_ssh_private_key'
hosts_group_name=eap wildfly_version=7.4 override_install_name=jboss-eap"
create-demo-setup.yml

作為 playbook 執行的一部分,將克隆azure-eap-demo存儲庫。create-demo-setup.yml文件包含:

- name: Create Azure VM
  hosts: localhost
  gather_facts: false
  connection: local
  vars:
   repo_url: "https://github.com/ansible-middleware/wildfly-cluster-demo.git"
   branch: main
  tasks:
   - name: Git checkout
     ansible.builtin.git:
       repo: "{{ repo_url }}"
       dest: "{{ playbook_dir }}/wildfly-cluster-demo"
       version: "{{ branch }}"
       single_branch: yes
       clone: yes
       update: yes

   - name: Create demo resources on azure.
     include_role:
       name: 'azure'
     vars:
       ssh_key_path: "{{ ssh_key | default(lookup('env', 'HOME') + '/.ssh/id_rsa.pub')}}"

   - meta: refresh_inventory
   - pause:
       minutes: 1

- name: Run wildfly-cluster-demo
  import_playbook: wildfly-cluster-demo/playbook.yml

該劇本創建應用程序所需的 Azure 資源,包括資源組、虛擬網絡、子網、安全組、網絡接口、運行 Red Hat Enterprise Linux 的三個虛擬機以及虛擬機的公共 IP 地址。

Azure 雲實例的所有默認參數都在安裝包中roles/azure/defaults/main.yml

最後,劇本部署 WildFly 集群演示。請參閱文章使用 Ansible 自動化和部署 JBoss EAP 集群以了解有關如何使用 WildFly 的更多信息。

步驟 5. 驗證 JBoss EAP 集群和應用程序的部署

一旦 playbook 成功完成,您可以通過登錄Azure 門戶來驗證 JBoss EAP 集群。在這裡,您將找到為支持 JBoss EAP 集群而創建的所有資源。登錄或 SSH 到任何創建的虛擬機,並確認 WildFly 服務正在運行且可訪問。或者,您可以運行wildfly-cluster-demovalidate.yml應用程序中提供的 playbook 來驗證配置。

步驟 6.清理 Azure 資源

要清理在 Azure 上創建的所有資源,請運行clean-demo-resources.ymlplaybook:

$ ansible-playbook clean-demo-resources.yml

內容clean-demo-resources.yml如下:

- name: Create Azure VM
  hosts: localhost
  connection: local
  tasks:
   - name: Create VM's on azure.
     include_role:
       name: 'azure'
     vars:
       action: destroy

destroy操作運行roles/azure/tasks/destroy.yml文件,其中包含:

---
- name: Remove a VM and all resources that were autocreated
  azure_rm_virtualmachine:
   resource_group: "{{ item.resourcegroup_name }}"
   name: "{{ item.name }}"
   remove_on_absent: all_autocreated
   state: absent
  loop: "{{ vm }}"

- name: Delete a resource group including resources it contains
  azure_rm_resourcegroup:
   name: "{{ item.name }}"
   force_delete_nonempty: yes
   state: absent
  loop: "{{ resource_groups }}"

playbook 移除所有虛擬機並刪除eap-cluster資源組下的所有資源。

Ansible 簡化了 Azure 上的部署

在本文中,我們演示了在 Microsoft Azure 上使用 Ansible 創建資源並使用 Ansible Middleware 項目中的工具部署 JBoss EAP 集群的分步過程。查看 ansible -middleware GitHub 組織和Ansible Middleware 網站中的其他集合和演示。

鏈接:https ://developers.redhat.com/articles/2022/08/17/how-ansible-simplifies-jboss-eap-deployment-azure

#redhat #aruze #jboss

Eric  Bukenya

Eric Bukenya

1624713540

Learn NoSQL in Azure: Diving Deeper into Azure Cosmos DB

This article is a part of the series – Learn NoSQL in Azure where we explore Azure Cosmos DB as a part of the non-relational database system used widely for a variety of applications. Azure Cosmos DB is a part of Microsoft’s serverless databases on Azure which is highly scalable and distributed across all locations that run on Azure. It is offered as a platform as a service (PAAS) from Azure and you can develop databases that have a very high throughput and very low latency. Using Azure Cosmos DB, customers can replicate their data across multiple locations across the globe and also across multiple locations within the same region. This makes Cosmos DB a highly available database service with almost 99.999% availability for reads and writes for multi-region modes and almost 99.99% availability for single-region modes.

In this article, we will focus more on how Azure Cosmos DB works behind the scenes and how can you get started with it using the Azure Portal. We will also explore how Cosmos DB is priced and understand the pricing model in detail.

How Azure Cosmos DB works

As already mentioned, Azure Cosmos DB is a multi-modal NoSQL database service that is geographically distributed across multiple Azure locations. This helps customers to deploy the databases across multiple locations around the globe. This is beneficial as it helps to reduce the read latency when the users use the application.

As you can see in the figure above, Azure Cosmos DB is distributed across the globe. Let’s suppose you have a web application that is hosted in India. In that case, the NoSQL database in India will be considered as the master database for writes and all the other databases can be considered as a read replicas. Whenever new data is generated, it is written to the database in India first and then it is synchronized with the other databases.

Consistency Levels

While maintaining data over multiple regions, the most common challenge is the latency as when the data is made available to the other databases. For example, when data is written to the database in India, users from India will be able to see that data sooner than users from the US. This is due to the latency in synchronization between the two regions. In order to overcome this, there are a few modes that customers can choose from and define how often or how soon they want their data to be made available in the other regions. Azure Cosmos DB offers five levels of consistency which are as follows:

  • Strong
  • Bounded staleness
  • Session
  • Consistent prefix
  • Eventual

In most common NoSQL databases, there are only two levels – Strong and EventualStrong being the most consistent level while Eventual is the least. However, as we move from Strong to Eventual, consistency decreases but availability and throughput increase. This is a trade-off that customers need to decide based on the criticality of their applications. If you want to read in more detail about the consistency levels, the official guide from Microsoft is the easiest to understand. You can refer to it here.

Azure Cosmos DB Pricing Model

Now that we have some idea about working with the NoSQL database – Azure Cosmos DB on Azure, let us try to understand how the database is priced. In order to work with any cloud-based services, it is essential that you have a sound knowledge of how the services are charged, otherwise, you might end up paying something much higher than your expectations.

If you browse to the pricing page of Azure Cosmos DB, you can see that there are two modes in which the database services are billed.

  • Database Operations – Whenever you execute or run queries against your NoSQL database, there are some resources being used. Azure terms these usages in terms of Request Units or RU. The amount of RU consumed per second is aggregated and billed
  • Consumed Storage – As you start storing data in your database, it will take up some space in order to store that data. This storage is billed per the standard SSD-based storage across any Azure locations globally

Let’s learn about this in more detail.

#azure #azure cosmos db #nosql #azure #nosql in azure #azure cosmos db

Ruthie  Bugala

Ruthie Bugala

1620435660

How to set up Azure Data Sync between Azure SQL databases and on-premises SQL Server

In this article, you learn how to set up Azure Data Sync services. In addition, you will also learn how to create and set up a data sync group between Azure SQL database and on-premises SQL Server.

In this article, you will see:

  • Overview of Azure SQL Data Sync feature
  • Discuss key components
  • Comparison between Azure SQL Data sync with the other Azure Data option
  • Setup Azure SQL Data Sync
  • More…

Azure Data Sync

Azure Data Sync —a synchronization service set up on an Azure SQL Database. This service synchronizes the data across multiple SQL databases. You can set up bi-directional data synchronization where data ingest and egest process happens between the SQL databases—It can be between Azure SQL database and on-premises and/or within the cloud Azure SQL database. At this moment, the only limitation is that it will not support Azure SQL Managed Instance.

#azure #sql azure #azure sql #azure data sync #azure sql #sql server

Awesome Ansible List

Awesome Ansible

A collaborative curated list of awesome Ansible resources, tools, Roles, tutorials and other related stuff.

Ansible is an open source toolkit, written in Python, it is used for configuration management, application deployment, continuous delivery, IT infrastructure automation and automation in general.

Official resources

Official resources by and for Ansible.

Community

Places where to chat with the Ansible community

Tutorials

Tutorials and courses to learn Ansible.

Books

Books about Ansible.

Videos

Video tutorials and Ansible training.

Tools

Tools for and using Ansible.

  • Ansible Tower - Ansible Tower by Red Hat helps you scale IT automation, manage complex deployments and speed productivity. Extend the power of Ansible to your entire team.
  • AWX - AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is the upstream project for Tower, a commercial derivative of AWX.
  • Ansible Lint - Checks Playbooks for best practices and behavior that could potentially be improved.
  • Ansible Later - Another best practice scanner. Checks Playbooks and Roles for best practices and behavior that could potentially be improved.
  • Ansible Doctor - Simple annotation like documentation generator for Ansible roles based on Jinja2 templates.
  • Ansible cmdb - Takes the output of Ansible's fact gathering and converts it into a static HTML page.
  • ARA - ARA Records Ansible playbooks and makes them easier to understand and troubleshoot with a reporting API, UI and CLI.
  • Mitogen for Ansible - Speed up Ansible substantially with Mitogen.
  • Molecule - Molecule aids in the development and testing of Ansible roles.
  • Packer Ansible Provisioner - This Provisioner can be used to automate VM Image creation via Packer with Ansible.
  • Excel Ansible Inventory - Turn any Excel Spreadsheet into an Ansible Inventory.
  • terraform.py - Ansible dynamic inventory script for parsing Terraform state files.
  • ansible-navigator - A text-based user interface (TUI) for Ansible.
  • squest - Self-service portal for Ansible Tower job templates.
  • ansible-bender - Tool which bends containers using Ansible playbooks and turns them into container images.
  • ansible-runner - A tool and python library that helps when interfacing with Ansible directly or as part of another system whether that be through a container image interface, as a standalone tool, or as a Python module that can be imported.
  • ansible-builder - Using Ansible content that depends on non-default dependencies can be tricky. Packages must be installed on each node, play nicely with other software installed on the host system, and be kept in sync.
  • kics - SAST Tool that scans your ansible infrastructure as code playbooks for security vulnverables, compliance issues and misconfigurations.
  • php-ansible Library - OOP-Wrapper for Ansible, making Ansible available in PHP.
  • TD4A - Design aid for building and testing jinja2 templates, combines data in yaml format with a jinja2 template and render the output.
  • Ansible Playbook Grapher - Command line tool to create a graph representing your Ansible playbook plays, tasks and roles.
  • ansible-doc-extractor - A tool that extracts documentation from Ansible modules in the HTML form.
  • Ansible Semaphore - Ansible Semaphore is a modern UI for Ansible.

Blog posts and opinions

Best practices and other opinions on Ansible.

German

Playbooks, Roles and Collections

Awesome production ready Playbooks, Roles and Collections to get you up and running.


Download Details:

Author: ansible-community
Source Code: https://github.com/ansible-community/awesome-ansible

License: CC0-1.0 license

#ansible 

Ron  Cartwright

Ron Cartwright

1600624800

Getting Started With Azure Event Grid Viewer

In the last article, we had a look at how to start with Azure DevOps: Getting Started With Audit Streaming With Event Grid

In the article, we will go to the next step to create a subscription and use webhook event handlers to view those logs in our Azure web application.

#cloud #tutorial #azure #event driven architecture #realtime #signalr #webhook #azure web services #azure event grid #azure #azure event grid #serverless architecture #application integration