Merge "Use a single configuration file for specifying docker containers."
[apex-tripleo-heat-templates.git] / docker / services / collectd.yaml
1 heat_template_version: pike
2
3 description: >
4   Containerized collectd service
5
6 parameters:
7   DockerCollectdImage:
8     description: image
9     type: string
10   DockerCollectdConfigImage:
11     description: The container image to use for the collectd config_volume
12     type: string
13   EndpointMap:
14     default: {}
15     description: Mapping of service endpoint -> protocol. Typically set
16                  via parameter_defaults in the resource registry.
17     type: json
18   ServiceData:
19     default: {}
20     description: Dictionary packing service data
21     type: json
22   ServiceNetMap:
23     default: {}
24     description: Mapping of service_name -> network name. Typically set
25                  via parameter_defaults in the resource registry.  This
26                  mapping overrides those in ServiceNetMapDefaults.
27     type: json
28   DefaultPasswords:
29     default: {}
30     type: json
31   RoleName:
32     default: ''
33     description: Role name on which the service is applied
34     type: string
35   RoleParameters:
36     default: {}
37     description: Parameters specific to the role
38     type: json
39
40
41 resources:
42
43   ContainersCommon:
44     type: ./containers-common.yaml
45
46   CollectdBase:
47     type: ../../puppet/services/metrics/collectd.yaml
48     properties:
49       EndpointMap: {get_param: EndpointMap}
50       ServiceData: {get_param: ServiceData}
51       ServiceNetMap: {get_param: ServiceNetMap}
52       DefaultPasswords: {get_param: DefaultPasswords}
53       RoleName: {get_param: RoleName}
54       RoleParameters: {get_param: RoleParameters}
55
56 outputs:
57   role_data:
58     description: Role data for the collectd role.
59     value:
60       service_name: {get_attr: [CollectdBase, role_data, service_name]}
61       config_settings:
62         map_merge:
63           - get_attr: [CollectdBase, role_data, config_settings]
64           - tripleo::profile::base::metrics::collectd::enable_file_logging: true
65             collectd::plugin::logfile::log_file: /var/log/collectd/collectd.log
66       step_config: &step_config
67         get_attr: [CollectdBase, role_data, step_config]
68       service_config_settings: {get_attr: [CollectdBase, role_data, service_config_settings]}
69       # BEGIN DOCKER SETTINGS
70       puppet_config:
71         config_volume: collectd
72         puppet_tags:  collectd_client_config
73         step_config: *step_config
74         config_image: {get_param: DockerCollectdConfigImage}
75       kolla_config:
76         /var/lib/kolla/config_files/collectd.json:
77           command: /usr/sbin/collectd -f
78           config_files:
79             - source: "/var/lib/kolla/config_files/src/*"
80               dest: "/"
81               merge: true
82               preserve_properties: true
83           permissions:
84             - path: /var/log/collectd
85               owner: collectd:collectd
86               recurse: true
87       docker_config:
88         step_3:
89           collectd:
90             image: {get_param: DockerCollectdImage}
91             net: host
92             privileged: true
93             restart: always
94             volumes:
95               list_concat:
96                 - {get_attr: [ContainersCommon, volumes]}
97                 -
98                   - /var/run/docker.sock:/var/run/docker.sock:rw
99                   - /var/lib/kolla/config_files/collectd.json:/var/lib/kolla/config_files/config.json:ro
100                   - /var/lib/config-data/puppet-generated/collectd/:/var/lib/kolla/config_files/src:ro
101             environment:
102               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
103       host_prep_tasks:
104         - name: create persistent logs directory
105           file:
106             path: /var/log/containers/collectd
107             state: directory
108       upgrade_tasks:
109         - name: Stop and disable collectd service
110           tags: step2
111           service: name=collectd.service state=stopped enabled=no