Application Centric Deployment

Introduction to application centric deployment

Application centric deployment (ACD) describes a fundamentally different approach to provisioning and configuring hosts in orcharhino. Traditionally, orcharhino has pursued a host-centric approach. Now, the ACD approach presents a new idea: deploying hosts to run an application that requires a predefined set of services.

Generally, an application consists of multiple services and therefore requires different kinds of hosts connected to each other. These hosts have dependencies on each other, for example, an application server might require a database server.

The number of deployed hosts depends on the expected usage of the application. You can scale an application instance vertically via compute profile or horizontally by choosing multiple hosts to run the same service to handle increased workloads.

Within ACD, Ansible playbooks are executed on orcharhino Server. Ensure that orcharhino Server can connect to your hosts using Ansible.

Host centric vs. application centric deployment

Host centric deployment

Application centric deployment

Requirements

none (possible by default)

ACD plugin

Focus

individual hosts

applications

Number of Hosts

one

one to many

Automation

via Host Group

via Ansible playbook and application definition

Advantages

full control over each host

deploy a number of hosts at once; self service for technically less inclined; scale vertically and/or horizontally

Disadvantages

extra abstraction layer between a host and its purpose

dependency on/limitation to existing application templates

Application centric deployment usage example

The following application centric deployment example illustrates the deployment of hosts in an application centric approach. The web application requires an HAProxy, an Apache web server, a Tomcat application server, and a database server.

Using ACD, this web application can be deployed and configured in a single step:

  1. Import the Ansible playbook

    Upload the Ansible playbook to your orcharhino Server. Specify the path and the name of the Ansible playbook using the orcharhino management UI.

  2. Create an application definition

    This example requires four different services: proxy servers, web servers, application servers, and database servers. Those hosts are ideally part of a host group.

  3. Optional: Customize Ansible variables

    You can either use the default values, change values, or lock the Ansible variables from being edited for an application instance. Ansible variables are read from the group variables of the Ansible playbook.

  4. Optional: Overwrite variables from the host group

    For example, change the compute profile or set a different lifecycle environment.

  5. Deploy an application instance

    You may simply deploy the application instance; run the Ansible playbook as is; or customize the Ansible playbook before running it.

If you want to install a package using an Ansible playbook and the host is subscribed to orcharhino Server, ensure that the package exists in the content view.

Key Terms in Application Centric Deployment

ACD

ACD stands for Application Centric Deployment and describes a new approach to provision and configure hosts based on the service they provide.

Ansible Playbooks

Ansible Playbooks are the core of the application definition. They connect the different services and provide a whole application with one click of a button. These playbooks contain roles, which in turn contain tasks to properly configure hosts.

Application Definitions

Application Definitions are blueprints of how to deploy an application and its services.

Application Instances

Application Definitions are configured application definitions. You can define how many hosts to deploy per service and choose unique host names. You can create different configurations whether its a testing or production environment or its expected usage. For example, deploying a wiki platform for 20 users might use the 1-small compute profile, whereas hundreds of expected users might require the 3-large compute profile.

Service

A service is a type of host necessary to run an application. For example, the LAMP stack consists of three services: an Apache webserver, a MySQL database, and PHP scripting language all running on Linux servers.

Host Groups

Host groups are predefined sets of provisioning and configuration settings for a new host. For more information, see Creating a Host Group in Managing Hosts.

Prerequisites for application centric deployment

In order to use the ACD plugin, your orcharhino instance must be able to deploy a host and offer properly configured host groups.

ACD architecture

ACD uses orcharhino Proxies and a remote execution provider called acd.

Ansible playbooks are downloaded from orcharhino Server to orcharhino Proxy Server before being executed. Submit any Ansible playbooks that you want to use to orcharhino Server. You do not have to manually add Ansible playbooks to orcharhino Proxy Servers.

Ansible playbooks

Ansible playbooks provide the configuration of deployed applications. They are required along with to an Application Definitions to create Application Instances.

Ansible group variables are mandatory and support any valid YAML data.

Ansible playbooks need to contain Ansible group variables for each provided service.

The Ansible inventory is automatically created by the ACD plugin.

In the orcharhino management UI, navigate to Applications > Ansible Playbooks to manage Ansible playbooks for application centric deployment.

The Ansible playbook must contain all necessary roles and tasks to execute the playbook.

If your Ansible playbooks are currently using Ansible collections, ensure that these Ansible collections are added manually to every orcharhino Proxy Server. To install Ansible collections manually, enter the following command on your orcharhino Server and orcharhino Proxy Server:

# ansible-galaxy collection install namespace.collection

Replace namespace.collection with the Ansible collection you are intending to use, for example community.general. This uses the Ansible galaxy as configured in the ansible.cfg file.

Application definitions

Application definitions are blueprints of deployed applications. They are required along with an Ansible Playbooks to create Application Instances.

Application definitions consist of a list of services and Ansible group variables and serve as a preconfigured blueprint providing easy self service for end users. Each service has a name, host group, Ansible group, and minimum and maximum number of host running this service.

Users with administrative access to orcharhino handle application definitions and specify the allowed number of hosts for each service.

In the orcharhino management UI, navigate to Applications > App Definitions to add, edit, and remove application definitions for application centric deployment.

Application instances

An application instance is based on a preconfigured Application Definitions. You can use an application instance to automatically deploy and configure hosts based on its application definition and Ansible playbook.

Based on one application definition, end users can configure and deploy multiple application instances.

In the orcharhino management UI, navigate to Applications > App Instances to add, deploy, and remove application instances for application centric deployment.

Ansible variables and parameter hierarchy

There are different levels on how to set Ansible variables and parameters for a host.

Ansible variables
  • On the base, there are Ansible group variables for all services as defined in the Ansible playbook.

  • Next, there are Ansible group variables defined for all services in the application definition. Individual Ansible variables can be locked, removed, or added to the application definition. They overwrite the ones from the Ansible playbook.

  • An application definition also contains Ansible variables for service groups. These overwrite Ansible variables set for all services.

  • An application instance can overwrite any unlocked Ansible variables from the application definition.

Parameters
  • Hosts inherit parameters from multiple entities:

    • Global parameters

    • Organization parameters

    • Location parameters

    • Domain parameters

    • Subnet parameters

    • Operating system parameters

    • Host group parameters

    • Host parameters

    For example, domain level parameters overwrite both location and organization based parameters and host parameters overwrite any other defined parameter.

For more information about Ansible variable precedence, see the Ansible documentation.

User roles for application centric deployment

The ACD plugin requires the specific orcharhino permissions. Depending on your environment, there might be two different groups of users in regard to managing an application and deploying an application:

You can interact with three different resources for ACD:

ACD resources
  • Ansible playbooks: Applications > Ansible Playbooks

  • Application definitions: Applications > App Definitions

  • Application instances: Applications > App Instances

You can create custom roles in the orcharhino management UI based on existing user role filters for these resources.

  • An administrative group of users might be responsible for providing the tools to deploy an application, that is an Ansible playbook and application definition. Note that the Ansible playbook is not related to the Ansible plugin for configuration management.

  • An end user group might be using orcharhino to deploy applications, that is creating and deploying application instances based on application definitions within their organization and location context. Many application instances can be created based on the same application definition.

By default, there are two ACD user roles:

Application Centric Deployment Manager

Configuring Ansible playbooks and application definitions requires the Application Centric Deployment Manager user role. It bundles permissions to manage Ansible playbooks, application definitions, and application instances as well as using ACD remote execution features. This role is suited for administrative users. The ACD manager role includes permissions to deploy and configure hosts; to manage Ansible playbooks, application definitions, and application instances; and to view, create, and cancel job invocations and templates.

Application Centric Deployment User

Creating and deploying application instances requires the Application Centric Deployment User user role. It bundles permissions to manage application instances and access to the ACD remote execution features. This role is suited for end users. The ACD user role includes permissions to deploy and configure hosts; to manage application instances; and to view, create, and cancel job invocations and templates.

Installing ACD on orcharhino Server

ACD has a orcharhino plugin (foreman_acd) and a orcharhino Proxy plugin (smart_proxy_acd).

Procedure
  1. Install ACD on your orcharhino Server:

    # orcharhino-installer --enable-foreman-plugin-acd --enable-foreman-proxy-plugin-acd

Installing ACD on orcharhino Proxy Server

Prerequisites
Procedure
  1. Install ACD on your orcharhino Proxy Server:

    # orcharhino-installer --enable-foreman-proxy-plugin-acd

Using ACD

Viewing an Ansible playbook

You can view existing Ansible Playbooks used for application centric deployment in the orcharhino management UI.

Procedure
  1. In the orcharhino management UI, navigate to Applications > Ansible Playbooks.

  2. Select an entry in the list of Ansible playbooks.

Adding an Ansible playbook

You can add Ansible Playbooks used for application centric deployment in the orcharhino management UI.

Procedure
  1. In the orcharhino management UI, navigate to Applications > Ansible Playbooks.

  2. Click New Ansible Playbook.

  3. In the Name field, enter the name of new Ansible playbook.

  4. In the Description field, enter an arbitrary description.

  5. In the SCM Type list, select either directory if the Ansible playbook is located on your orcharhino Server or git to reference a remote git repository.

    • If you select directory, enter the location of the Ansible playbook on your orcharhino Server in the Directory Path field.

      To avoid SELinux issues, add the Ansible playbook to the /var/lib/foreman/foreman_acd/ansible-playbooks/ directory.

    • If you select git, enter the remote location in the Git Url field and a git branch, commit, or tag in the Git Branch/Commit/Tag field.

      Click Sync Repository to fetch the remote git repository.

  6. In the Playfile field, enter the name of the Ansible playbook.

  7. Click Submit to save your Ansible playbook.

  8. Once submitted, click Import groups to import Ansible group variables before this Ansible playbook can be used for an application definition.

You can only edit the directory path or git URL as long as it is not used by any application definition.

Making changes to any Ansible roles included in your Ansible playbook does not require reimporting the Ansible playbook using the orcharhino management UI.

Removing an Ansible playbook

You can remove Ansible Playbooks used for application centric deployment in the orcharhino management UI.

Procedure
  1. In the orcharhino management UI, navigate to Applications > Ansible Playbooks.

  2. Click Delete in the drop down menu to remove the Ansible playbook from your orcharhino Server.

Viewing an application definition

You can view existing Application Definitions used for application centric deployment in the orcharhino management UI.

Procedure
  1. In the orcharhino management UI, navigate to Applications > App Definitions.

  2. Select an entry in the list of application definitions.

Creating an application definition

Use this procedure to create Application Definitions to use as part of your application centric deployment.

Prerequisites

You need existing host groups in order to use application centric deployment.

Procedure
  1. In the orcharhino management UI, navigate to Applications > App Definitions.

  2. Click New Application Definition.

  3. In the Name field, enter the name of the new application definition.

  4. In the Description field, enter an arbitrary description.

  5. From the Ansible Playbook list, select the name of an Ansible playbook.

  6. Click the plus icon to add new sets of hosts.

    1. In the Name field, enter the name of the new set of hosts.

    2. In the Description field, enter an arbitrary description.

    3. From the Hostgroup menu, select an existing host group.

    4. From the Ansible Group menu, select existing Ansible group variables from the selected Ansible playbook.

    5. In the min count field, enter the minimum number of hosts providing this service. If it is unset, users can choose to not deploy a host providing this service at all.

    6. In the max count field, enter the maximum number of hosts providing this service. If it is unset, users can choose to deploy an unlimited number of hosts providing this service.

    7. In the Actions column, complete the following steps:

      1. Click the edit icon to edit an entry;

      2. Click the settings icon to add or edit existing orcharhino parameters. Every hierarchy level of orcharhino parameters can be overwritten.

      3. Click the A character to edit, add, lock, or delete Ansible group variables;

      4. Click the delete icon to delete an entry.

  7. Click Submit to save your application definition.

Removing an application definition

You can remove Application Definitions used for application centric deployment in the orcharhino management UI.

Procedure
  1. In the orcharhino management UI, navigate to Applications > App Definitions.

  2. Click Delete to remove the application definition from your orcharhino Server.

Setting host parameters in application definitions

You can add and edit host parameters for individual application definitions.

Procedure
  1. In the orcharhino management UI, navigate to Applications > Application Definitions.

  2. Select an application definition.

  3. Click the settings icon in the Actions column.

  4. Click the + sign to add a new host parameter.

  5. Optional: Using the Actions column, you can edit an existing host parameter, lock or unlock host parameters, and delete host parameters.

  6. Click Save to save your application definition to orcharhino.

Locking parameters prevents users from changing them within an application instance.

Viewing an application instance

You can view existing Application Instances used for application centric deployment in the orcharhino management UI.

Procedure
  1. In the orcharhino management UI, navigate to Applications > App Instances.

  2. Select an entry in the list of application instances.

Creating an application instance

You can create Application Instances as a blueprint for users to provision and configure hosts.

Procedure
  1. In the orcharhino management UI, navigate to Application > App Instances.

  2. Click New Application Instance.

  3. In the Name field, enter the name of the new application instance.

  4. Optional: In the Description field, enter an arbitrary description.

  5. From the Application Definition menu, select an existing application definition.

  6. In the table, connect the hosts and necessary services. You can either assign existing hosts to your application instance or deploy new hosts.

    1. To assign an existing host to a service, click on the Server icon. Select both a service and existing host, and click Save.

    2. Optional: Click the A character to edit, add, lock, or delete Ansible group variables. Note that you cannot change host parameters as existing hosts are not redeployed but only reconfigured using Ansible.

    3. Alternatively, in the Hostname field, enter a unique name for the host. You can enter lowercase characters, digits, and hyphens. Hosts cannot start with a hyphen.

    4. In the Description field, enter a description.

    5. From the Service menu, choose a service from the selected application definition. Refer to the list of services in the top right corner.

    6. In the Actions column,

      1. click the edit icon to edit an entry;

      2. click the settings icon to add or edit existing orcharhino parameters. Every hierarchy level of orcharhino parameters can be overwritten.

      3. Click the A character to edit, add, lock, or delete Ansible group variables.

        You can refer to any orcharhino parameter using PARAM[name_of_your_parameter], for example, based on an operating system or a host group. The orcharhino parameter name cannot contain whitespace.

        When the host is configured, ACD gets the value for the variable name_of_your_parameter. When you deploy your application instance or reconfigure it afterwards, navigate to the Preview templates tab to check if the parameters are resolved correctly.

      4. Click the delete icon to delete an entry.

  7. Click the A character to view and edit the corresponding Ansible group variables. You may edit unlocked values.

  8. Click Submit to save your application instance.

Deploying an application instance

You can deploy multi-host applications using Application Instances.

Procedure
  1. In the orcharhino management UI, navigate to Applications > App Instances.

  2. Select the application instance you want to deploy and click Deploy. If the selected application instance has been deployed before, confirm that you want to redeploy to existing hosts.

The firewall settings must be handled by the Ansible playbook itself. Ensure to open any required network ports for any defined service by creating an additional role or task in the Ansible playbook.

ACD detects which orcharhino Proxy Server is used to configure the application instance and its hosts.

Deploying an ACD application instance

For each orcharhino Proxy Server, the Ansible playbook runs to configure all hosts. The remote execution plugin, which works host-based, is used to run the Ansible playbook on each orcharhino Proxy Server.

The first host of the application instance runs the Ansible playbook. The configuration jobs page shows the first host of each orcharhino Proxy Server as target host. The ACD component of orcharhino Proxy starts an Ansible playbook which configures all hosts connected to this orcharhino Proxy Server.

Running the Ansible playbook

You can rerun the Ansible playbook to reconfigure existing hosts.

Procedure
  1. In the orcharhino management UI, navigate to Applications > App Instances.

  2. Select the application instance you want to deploy and click Run Playbook from the drop down menu.

Customizing an Ansible playbook to reconfigure hosts

You can customize and rerun the Ansible playbook to reconfigure existing hosts.

Procedure
  1. In the orcharhino management UI, navigate to Applications > App Instances.

  2. Select the application instance you want to deploy and select Run Playbook – customize first from the drop-down menu. You can customize your application instance deployment and configuration as follows:

    • You can make the Ansible playbook output more verbose.

    • You can add more Ansible variables before executing the Ansible playbook.

    • You can set the amount of concurrently running Ansible tasks.

    • You can select specific tags and hereby limit the tasks of the Ansible playbook that will be executed. Alternatively, you can also choose to skip specific tasks by selecting tags to skip.

      Those options are passed to the Ansible playbook.

    Clicking Submit without making a change runs the Ansible playbook and deploys the application instance.

You can also choose to deploy the application instance at a certain point of time in the future or recurringly. For example, you can deploy an application every (Sunday) morning as part of a testing routine.

Removing an application instance

You can remove Application Instances used for application centric deployment using the orcharhino management UI.

Procedure
  1. In the orcharhino management UI, navigate to Application > App Instances.

  2. In the list of application instances, open the drop down menu and select Delete on the application instance you want to remove.

    This prompts a list of hosts that have been deployed via the selected application instance. You can either use the checkbox to select all or tick the hosts you want to delete when deleting the application instance. Otherwise, those hosts remain.

Overwriting Ansible group variables in application instances

You can overwrite Ansible group variables in application instances unless the parameters are locked by the application definition.

Procedure
  1. In the orcharhino management UI, navigate to Applications > App Instances.

  2. Select an application instance.

  3. To overwrite Ansible group variables for all services, click the A character below the table.

  4. To overwrite Ansible group variables on a per service basis, click the A character in the action menu next to a service.

  5. Click the edit icon to overwrite Ansible group variables from the application definition.

    A grayed out edit icon indicates that this Ansible group variable has been locked by the application definition.

  6. Click Save to update the Ansible group variables.

Note that it is not possible to add or remove parameters in the application instance.

Viewing application instance reports

You can view reports on the last application instance deployment.

Procedure
  1. In the orcharhino management UI, navigate to Applications > App Instances.

  2. Click on Show Report in the list of application instances.

  3. Click on Last deployment task to view the last deployment task in orcharhino.

Viewing the last deployment task

You can view the last deployment task for each application instance.

Procedure
  1. In the orcharhino management UI, navigate to Applications > App Instances.

  2. Click Show Report in the list of application instances.

  3. Click Last deployment task to view the last deployment task in orcharhino.

    The table shows basic information regarding the execution of the task. The indicator shows the state and overall status of the task, for example 100% complete. The other tabs Running Steps, Errors, Locks, and Raw contain more detailed information about the task.

The text and illustrations on this page are licensed by ATIX AG under a Creative Commons Attribution Share Alike 4.0 International ("CC BY-SA 4.0") license. This page also contains text from the official Foreman documentation which uses the same license ("CC BY-SA 4.0").