Create a simple bundle

Creating a simple bundle for ADCM consists of preparing Ansible playbooks and configuration file in the YAML format (at this page we will also call it the config file).

  • Ansible playbooks are necessary to specify and run actions that will be performed at hosts.

  • Config file is necessary to declare and specify the objects the bundle will contain. You can create a common configuration file for all objects or you can create separate configuration files for different objects. Configuration file should be named config.yaml or config.yml. Configuration files can be located inside the root directory, or inside a directory that you set.

The prepared Ansible playbooks and configuration files are archived in a file of .tgz format that is, essentially, an ADCM bundle.

Let’s take a closer look at the config.yaml file structure.

The config.yaml file

ADCM bundles may be of two types: the cluster bundle or the infrastructure bundle.

  • Configuration file for a cluster bundle may contain sections that specify clusters, services, and their components.

  • Configuration file for an infrastructure bundle may contain sections that specify hostproviders and hosts.

IMPORTANT
The configuration file for a bundle may contain descriptions only for those objects that correspond to the bundle type. For example, the configuration file for a cluster bundle can contain descriptions for clusters and services while it can not contain descriptions for hosts.

The main sections of the config.yaml file are listed below.

Sections of the config.yaml file

The configuration file for a cluster bundle may contain the following sections:

  • type — the object type. Takes the cluster or service values in case of cluster bundle and the hostprovider or host values in case of infrastructure bundle.

  • name — the object name.

  • description — the object description.

  • version — the object (cluster, service, or hostprovider) version. Is not applicable for components and hosts.

  • edition — the object (cluster or hostprovider) edition.

  • license — the path to the license agreement file.

  • adcm_min_version — the minimum ADCM version the bundle works on.

  • upgrade — the operation available from an object’s (cluster or hostprovider) certain state that updates object’s meta-information and moves it to a different state (with possible restrictions regarding the version and edition values). Product version may contain several product editions.

  • config — the description of a configuration of an object (cluster, service, component, host, or hostprovider). After bundle upload and object creation, the object inside the ADCM interface will display the settings (on the Settings page) that were specified in this section.

  • actions — the sets of actions that can be performed with an object (cluster, service, component, host, or hostprovider). Those actions are expressed as Ansible playbooks. The display of actions for an object in the ADCM interface depends on the object state.

  • import — the settings of services that an object (cluster or service) can accept from another cluster’s objects. For example, a cluster may accept the settings of the ZooKeeper service from another cluster (only the service settings are transmitted, the service itself is not being physically added). This functionality is essentially needed for the settings exchange between different clusters.

  • export — the settings of services that an object (cluster or service) can transmit to another cluster’s objects. This functionality is essentially needed for the settings exchange between different clusters.

Example

Below you can find an example of the config.yaml file for a ZooKeeper cluster bundle. The file contains the sections discussed above.

---
- type: cluster
  name: Zookeeper cluster
  description: Zookeeper cluster software
  version: 2.0.0
  edition: community
  license: EULA.txt
  adcm_min_version: 2022.10.04.17

  upgrade:
    - name: 2.0.0 community
      versions:
        min: "1.5.0"
        max_strict: "1.9.9"
      from_edition: ['community']
      states:
        available: any
        on_success: upgrade from 1.5.X

  config:
    - name: centos7_repos
      display_name: "Centos 7 repositories"
      type: group
      subs:
        - name: Zookeeper
          type: map
          description: Arenadata Zookeeper yum repository
          default:
            desc: Arenadata Zookeeper yum repository
            url: http://downloads.arenadata.io/zookeeper/3.5.8/centos/7/community/$basearch/
            enabled: "True"

  actions:
    Install:
      display_name: Install
      type: task
      scripts:
        - name: preinstall
          display_name: "Preinstall"
          script_type: ansible
          script: ansible/cluster_preinstall.yaml
          params:
            ansible_tags: preinstall, service_dependency_check
        - name: zookeeper
          display_name: "Zookeeper"
          script_type: ansible
          script: adcm_service_zookeeper/ansible/zookeeper.yml
          params:
            ansible_tags: install, configure, start
      states:
        available:
          - created
	on_success: installed


- type: service
  name: zookeeper
  display_name: Zookeeper
  version:

  export:
    - Main

  config:
    - name: Main
      type: group
      subs:
        - name: connect
	  type: string
	  read_only: any
	  required: no
	  description: >
	    Zookeeper connection string that is used by other services or clusters.
	    It is generated automatically.
	- name: data_dirs
	  display_name: dataDir
          type: string
	  default: "/var/lib/zookeeper"
	  description: >
	    The location where Zookeeper stores the in-memory database snapshots and, unless specified otherwise, the transaction log of updates to the database.
	    Specified as the dataDir parameter in the zoo.cfg configuration file.

  actions:
    Start:
      type: job
      script_type: ansible
      script: ./ansible/zookeeper.yml
      params:
        ansible_tags: configure, configure_main_info, start
      states:
        available:
          - installed

  components:
    SERVER:
      display_name: Zookeeper Server
      constraint: [odd]
      actions:
        Start:
	  type: job
	  script_type: ansible
	  script: ./ansible/zookeeper_server.yml
	  params:
	    ansible_tags: configure, configure_main_info, start
	  states:
	    available:
	      - installed
Found a mistake? Seleсt text and press Ctrl+Enter to report it