tripleo-heat-templates/deployment/ceilometer/ceilometer-agent-notification-container-puppet.yaml
Takashi Kajinami ff83505e8a Replace hiera by lookup
The hiera function is deprecated and does not work with the latest
hieradata version 5. It should be replaced by the new lookup
function[1].

[1] https://puppet.com/docs/puppet/7/hiera_automatic.html

With the lookup function, we can define value type and merge behavior,
but these are kept default at this moment to limit scope of this change
to just simple replacement. Adding value type might be useful to make
sure the value is in expected type (especially when a boolean value is
expected), but we will revisit that later.

example:
lookup(<NAME>, [<VALUE TYPE>], [<MERGE BEHAVIOR>], [<DEFAULT VALUE>])

Change-Id: If5ac88ffccc1bb800d8af33c8896294a57e9b5fb
2022-04-14 17:07:52 +09:00

241 lines
9.4 KiB
YAML

heat_template_version: wallaby
description: >
OpenStack containerized Ceilometer Agent Notification service
parameters:
ContainerCeilometerNotificationImage:
description: image
type: string
tags:
- role_specific
ContainerCeilometerConfigImage:
description: The container image to use for the ceilometer config_volume
type: string
tags:
- role_specific
CeilometerAgentNotificationLoggingSource:
type: json
default:
tag: openstack.ceilometer.agent.notification
file: /var/log/containers/ceilometer/agent-notification.log
EndpointMap:
default: {}
description: Mapping of service endpoint -> protocol. Typically set
via parameter_defaults in the resource registry.
type: json
ServiceData:
default: {}
description: Dictionary packing service data
type: json
ServiceNetMap:
default: {}
description: Mapping of service_name -> network name. Typically set
via parameter_defaults in the resource registry. Use
parameter_merge_strategies to merge it with the defaults.
type: json
RoleName:
default: ''
description: Role name on which the service is applied
type: string
RoleParameters:
default: {}
description: Parameters specific to the role
type: json
MonitoringSubscriptionCeilometerNotification:
default: 'overcloud-ceilometer-agent-notification'
type: string
MetricsQdrPort:
default: 5666
description: Service name or port number on which the qdrouterd will accept
connections.
type: number
CeilometerQdrPublishEvents:
default: false
description: Whether to send events to MetricsQdr service.
type: boolean
CeilometerQdrPublishMetrics:
default: false
description: Whether to send telemetry data to MetricsQdr service.
type: boolean
CeilometerQdrEventsConfig:
default:
driver: amqp
topic: event
description: Configuration for notifier publisher for events.
type: json
CeilometerQdrMetricsConfig:
default:
driver: amqp
topic: metering
description: Configuration for notifier publisher for metrics.
type: json
ManageEventPipeline:
default: true
description: Whether to manage event_pipeline.yaml.
type: boolean
EventPipelinePublishers:
default: []
description: >
A list of publishers to put in event_pipeline.yaml. When the
collector is used, override this with notifier:// publisher.
Set ManageEventPipeline to true for override to take effect.
type: comma_delimited_list
ManagePipeline:
default: false
description: Whether to manage pipeline.yaml.
type: boolean
PipelinePublishers:
default: []
description: >
A list of publishers to put in pipeline.yaml. When the
collector is used, override this with notifier:// publisher.
Set ManagePipeline to true for override to take effect.
type: comma_delimited_list
resources:
ContainersCommon:
type: ../containers-common.yaml
CeilometerServiceBase:
type: ./ceilometer-base-container-puppet.yaml
properties:
ServiceData: {get_param: ServiceData}
ServiceNetMap: {get_param: ServiceNetMap}
EndpointMap: {get_param: EndpointMap}
RoleName: {get_param: RoleName}
RoleParameters: {get_param: RoleParameters}
RoleParametersValue:
type: OS::Heat::Value
properties:
type: json
value:
map_replace:
- map_replace:
- ContainerCeilometerNotificationImage: ContainerCeilometerNotificationImage
ContainerCeilometerConfigImage: ContainerCeilometerConfigImage
- values: {get_param: [RoleParameters]}
- values:
ContainerCeilometerNotificationImage: {get_param: ContainerCeilometerNotificationImage}
ContainerCeilometerConfigImage: {get_param: ContainerCeilometerConfigImage}
conditions:
ceilometer_qdr_publish:
or:
- {get_param: CeilometerQdrPublishEvents}
- {get_param: CeilometerQdrPublishMetrics}
outputs:
role_data:
description: Role data for the Ceilometer Agent Notification role.
value:
service_name: ceilometer_agent_notification
monitoring_subscription: {get_param: MonitoringSubscriptionCeilometerNotification}
config_settings:
map_merge:
- get_attr: [CeilometerServiceBase, role_data, config_settings]
- ceilometer::agent::notification::manage_event_pipeline: {get_param: ManageEventPipeline}
ceilometer::agent::notification::manage_pipeline: {get_param: ManagePipeline}
tripleo::profile::base::ceilometer::agent::notification::notifier_enabled: {get_param: CeilometerQdrPublishMetrics}
tripleo::profile::base::ceilometer::agent::notification::notifier_events_enabled: {get_param: CeilometerQdrPublishEvents}
tripleo::profile::base::ceilometer::agent::notification::pipeline_publishers: {get_param: PipelinePublishers}
tripleo::profile::base::ceilometer::agent::notification::event_pipeline_publishers: {get_param: EventPipelinePublishers}
tripleo::profile::base::ceilometer::agent::notification::notifier_params: {get_param: CeilometerQdrMetricsConfig}
tripleo::profile::base::ceilometer::agent::notification::notifier_event_params: {get_param: CeilometerQdrEventsConfig}
- if: #Ceilometer connection to qdr
- ceilometer_qdr_publish
- tripleo::profile::base::ceilometer::agent::notification::notifier_host_addr:
str_replace:
template:
"%{lookup('$NETWORK')}"
params:
$NETWORK:
get_param:
- ServiceNetMap
- str_replace:
template: "ROLENAMEMetricsQdrNetwork"
params:
ROLENAME: {get_param: RoleName}
tripleo::profile::base::ceilometer::agent::notification::notifier_host_port: {get_param: MetricsQdrPort}
service_config_settings:
map_merge:
- get_attr: [CeilometerServiceBase, role_data, service_config_settings]
- rsyslog:
tripleo_logging_sources_ceilometer_agent_notification:
- {get_param: CeilometerAgentNotificationLoggingSource}
# BEGIN DOCKER SETTINGS
puppet_config:
config_volume: ceilometer
puppet_tags: ceilometer_config
step_config: |
include tripleo::profile::base::ceilometer::agent::notification
config_image: {get_attr: [RoleParametersValue, value, ContainerCeilometerConfigImage]}
kolla_config:
/var/lib/kolla/config_files/ceilometer_agent_notification.json:
command: /usr/bin/ceilometer-agent-notification --logfile /var/log/ceilometer/agent-notification.log
config_files:
list_concat:
- - source: "/var/lib/kolla/config_files/src/*"
dest: "/"
merge: true
preserve_properties: true
docker_config:
step_3:
ceilometer_init_log:
start_order: 0
image: &ceilometer_agent_notification_image {get_attr: [RoleParametersValue, value, ContainerCeilometerNotificationImage]}
net: none
user: root
command: ['/bin/bash', '-c', 'chown -R ceilometer:ceilometer /var/log/ceilometer']
volumes:
- /var/log/containers/ceilometer:/var/log/ceilometer:z
step_4:
ceilometer_agent_notification:
image: *ceilometer_agent_notification_image
net: host
privileged: false
restart: always
healthcheck: {get_attr: [ContainersCommon, healthcheck_rpc_port]}
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
- - /var/lib/kolla/config_files/ceilometer_agent_notification.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/ceilometer:/var/lib/kolla/config_files/src:ro
- /var/log/containers/ceilometer:/var/log/ceilometer:z
environment:
KOLLA_CONFIG_STRATEGY: COPY_ALWAYS
host_prep_tasks:
- name: create persistent directories
file:
path: "{{ item.path }}"
state: directory
setype: "{{ item.setype }}"
mode: "{{ item.mode }}"
with_items:
- { 'path': /var/log/containers/ceilometer, 'setype': container_file_t, 'mode': '0750' }
- name: enable virt_sandbox_use_netlink for healthcheck
seboolean:
name: virt_sandbox_use_netlink
persistent: true
state: true
when:
- ansible_facts.selinux is defined
- ansible_facts.selinux.status == "enabled"
external_upgrade_tasks:
- when:
- step|int == 1
tags:
- never
- system_upgrade_transfer_data
- system_upgrade_stop_services
block:
- name: Stop ceilometer agent notification container
import_role:
name: tripleo_container_stop
vars:
tripleo_containers_to_stop:
- ceilometer_agent_notification
tripleo_delegate_to: "{{ groups['ceilometer_agent_notification'] | default([]) }}"