Tasks hook for preparing BM host for deploying containerized services
This implements a host_prep_tasks hook where we can specify Ansible tasks to perform on the host before deploying containerized services. The hook runs in a single step, the assumption is that we will mostly use the hook for creating per-service directories on the host to ensure we are able to mount them into the containers. (We cannot do this operation via Puppet because all containerized services run their Puppet within a config container, so Puppet doesn't have access to host's filesystem.) Change-Id: I7d8bac39e0cd422fd651eefe29f7d10941ab4a1a
This commit is contained in:
parent
5fb25c2c4a
commit
6050809e57
@ -123,6 +123,32 @@ resources:
|
|||||||
servers: {get_param: [servers, {{role.name}}]}
|
servers: {get_param: [servers, {{role.name}}]}
|
||||||
config: {get_resource: {{role.name}}CreateConfigDir}
|
config: {get_resource: {{role.name}}CreateConfigDir}
|
||||||
|
|
||||||
|
{{role.name}}HostPrepAnsible:
|
||||||
|
type: OS::Heat::Value
|
||||||
|
properties:
|
||||||
|
value:
|
||||||
|
str_replace:
|
||||||
|
template: CONFIG
|
||||||
|
params:
|
||||||
|
CONFIG:
|
||||||
|
- hosts: localhost
|
||||||
|
connection: local
|
||||||
|
tasks: {get_param: [role_data, {{role.name}}, host_prep_tasks]}
|
||||||
|
|
||||||
|
{{role.name}}HostPrepConfig:
|
||||||
|
type: OS::Heat::SoftwareConfig
|
||||||
|
properties:
|
||||||
|
group: ansible
|
||||||
|
options:
|
||||||
|
modulepath: /usr/share/ansible-modules
|
||||||
|
config: {get_attr: [{{role.name}}HostPrepAnsible, value]}
|
||||||
|
|
||||||
|
{{role.name}}HostPrepDeployment:
|
||||||
|
type: OS::Heat::SoftwareDeploymentGroup
|
||||||
|
properties:
|
||||||
|
servers: {get_param: [servers, {{role.name}}]}
|
||||||
|
config: {get_resource: {{role.name}}HostPrepConfig}
|
||||||
|
|
||||||
# this creates a JSON config file for our docker-puppet.py script
|
# this creates a JSON config file for our docker-puppet.py script
|
||||||
{{role.name}}GenPuppetConfig:
|
{{role.name}}GenPuppetConfig:
|
||||||
type: OS::Heat::StructuredConfig
|
type: OS::Heat::StructuredConfig
|
||||||
@ -146,7 +172,7 @@ resources:
|
|||||||
|
|
||||||
{{role.name}}GenerateConfigDeployment:
|
{{role.name}}GenerateConfigDeployment:
|
||||||
type: OS::Heat::SoftwareDeploymentGroup
|
type: OS::Heat::SoftwareDeploymentGroup
|
||||||
depends_on: [{{role.name}}GenPuppetDeployment, {{role.name}}ArtifactsDeploy, {{role.name}}CreateConfigDirDeployment]
|
depends_on: [{{role.name}}GenPuppetDeployment, {{role.name}}ArtifactsDeploy, {{role.name}}CreateConfigDirDeployment, {{role.name}}HostPrepDeployment]
|
||||||
properties:
|
properties:
|
||||||
name: {{role.name}}GenerateConfigDeployment
|
name: {{role.name}}GenerateConfigDeployment
|
||||||
servers: {get_param: [servers, {{role.name}}]}
|
servers: {get_param: [servers, {{role.name}}]}
|
||||||
|
@ -74,6 +74,11 @@ outputs:
|
|||||||
{get_attr: [ServiceChain, role_data, docker_config]}
|
{get_attr: [ServiceChain, role_data, docker_config]}
|
||||||
docker_puppet_tasks:
|
docker_puppet_tasks:
|
||||||
{get_attr: [ServiceChain, role_data, docker_puppet_tasks]}
|
{get_attr: [ServiceChain, role_data, docker_puppet_tasks]}
|
||||||
|
host_prep_tasks:
|
||||||
|
yaql:
|
||||||
|
# Note we use distinct() here to filter any identical tasks
|
||||||
|
expression: $.data.where($ != null).select($.get('host_prep_tasks')).where($ != null).flatten().distinct()
|
||||||
|
data: {get_attr: [ServiceChain, role_data]}
|
||||||
upgrade_tasks:
|
upgrade_tasks:
|
||||||
yaql:
|
yaql:
|
||||||
# Note we use distinct() here to filter any identical tasks, e.g yum update for all services
|
# Note we use distinct() here to filter any identical tasks, e.g yum update for all services
|
||||||
|
@ -26,7 +26,7 @@ ENDPOINT_MAP_FILE = 'endpoint_map.yaml'
|
|||||||
REQUIRED_DOCKER_SECTIONS = ['service_name', 'docker_config', 'kolla_config',
|
REQUIRED_DOCKER_SECTIONS = ['service_name', 'docker_config', 'kolla_config',
|
||||||
'puppet_config', 'config_settings', 'step_config']
|
'puppet_config', 'config_settings', 'step_config']
|
||||||
OPTIONAL_DOCKER_SECTIONS = ['docker_puppet_tasks', 'upgrade_tasks',
|
OPTIONAL_DOCKER_SECTIONS = ['docker_puppet_tasks', 'upgrade_tasks',
|
||||||
'service_config_settings']
|
'service_config_settings', 'host_prep_tasks']
|
||||||
DOCKER_PUPPET_CONFIG_SECTIONS = ['config_volume', 'puppet_tags', 'step_config',
|
DOCKER_PUPPET_CONFIG_SECTIONS = ['config_volume', 'puppet_tags', 'step_config',
|
||||||
'config_image']
|
'config_image']
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user