Setting up work with Consul

This functionality is designed to change configuration files and apply changed values.

System Requirements

To configure the system, you need to:

When configuring Agent, you must specify the type of configuration consul. If Consul and Agent are configured and DCC is enabled, the Agent will poll every 60 seconds Consul for changed data for the node on which it is launched. Set force_dcc = true parameter in [consul] section to force enable dynamic configuration of host components and disable CloudManager polling.

Install

To configure the Agent, you need to make changes to the configuration file agent.conf, as indicated in setup documentation. Agent must have access rights to set up the required configuration files. Also, if necessary, to apply the changed parameters (restart of services systemd), it is necessary to configure the file /etc/aos/agent_consul_services.json. Example of this file:

{
  "nova": {
    "config_file": "/etc/nova/nova.conf",
    "restart_services": ["openstack-nova-*"]
  },
  "cinder": {
    "config_file": "/etc/cinder/cinder.conf",
    "restart_services": ["openstack-cinder-*"]
  }
}

Where:

  • nova, cinder are directory names in Consul to track parameters;
  • config_file is file to fix;
  • openstack-cinder-*, openstack-nova-* are mask for the names of the services that need to be restarted.

next step is to define the structure of the configuration files in the section key/value Consul. Structure requirements:

HostName
         ServiceName
                 SectionName
                       ParameterName
                                             Value

Where:

  • HostName is hostname where the parameters should be applied (no IP addresses are used);
  • ServiceName``is name of the service that is specified in ``/etc/aos/agent_consul_services.json. In our case, they are nova and cinder;
  • SectionName is name of the section to make the change;
  • ParameterName is name of the parameter to make the change;
  • Value is parameter value.

Additionally

  • If it is needed to apply the values on all nodes, then it is necessary to create a top-level directory default instead of the node name.
  • If the value of the same parameter is specified in default section and in hostname section, then the value from the hostname section will be applied.
  • If the parameter or section is not in configuration file, then Agent will add them automatically.