Add role specific information to the service template
[apex-tripleo-heat-templates.git] / docker / services / database / redis.yaml
1 heat_template_version: ocata
2
3 description: >
4   OpenStack containerized Redis services
5
6 parameters:
7   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerRedisImage:
12     description: image
13     default: 'centos-binary-redis:latest'
14     type: string
15   EndpointMap:
16     default: {}
17     description: Mapping of service endpoint -> protocol. Typically set
18                  via parameter_defaults in the resource registry.
19     type: json
20   ServiceNetMap:
21     default: {}
22     description: Mapping of service_name -> network name. Typically set
23                  via parameter_defaults in the resource registry.  This
24                  mapping overrides those in ServiceNetMapDefaults.
25     type: json
26   DefaultPasswords:
27     default: {}
28     type: json
29   RoleName:
30     default: ''
31     description: Role name on which the service is applied
32     type: string
33   RoleParameters:
34     default: {}
35     description: Parameters specific to the role
36
37 resources:
38
39   RedisBase:
40     type: ../../../puppet/services/database/redis.yaml
41     properties:
42       EndpointMap: {get_param: EndpointMap}
43       ServiceNetMap: {get_param: ServiceNetMap}
44       DefaultPasswords: {get_param: DefaultPasswords}
45
46 outputs:
47   role_data:
48     description: Role data for the Redis API role.
49     value:
50       service_name: {get_attr: [RedisBase, role_data, service_name]}
51       config_settings:
52         map_merge:
53           - {get_attr: [RedisBase, role_data, config_settings]}
54           - redis::daemonize: false
55       step_config: &step_config
56         get_attr: [RedisBase, role_data, step_config]
57       service_config_settings: {get_attr: [RedisBase, role_data, service_config_settings]}
58       # BEGIN DOCKER SETTINGS
59       puppet_config:
60         config_volume: 'redis'
61         # NOTE: we need the exec tag to copy /etc/redis.conf.puppet to
62         # /etc/redis.conf
63         # https://github.com/arioch/puppet-redis/commit/1c004143223e660cbd433422ff8194508aab9763
64         puppet_tags: 'exec'
65         step_config: *step_config
66         config_image: &redis_image
67           list_join:
68             - '/'
69             - [ {get_param: DockerNamespace}, {get_param: DockerRedisImage} ]
70       kolla_config:
71         /var/lib/kolla/config_files/redis.json:
72           command: /usr/bin/redis-server /etc/redis.conf
73           permissions:
74             - path: /var/run/redis
75               owner: redis:redis
76               recurse: true
77       docker_config:
78         step_1:
79           redis:
80             image: *redis_image
81             net: host
82             privileged: false
83             restart: always
84             volumes:
85               - /run:/run
86               - /var/lib/kolla/config_files/redis.json:/var/lib/kolla/config_files/config.json:ro
87               - /var/lib/config-data/redis/etc/:/etc/:ro
88               - /etc/localtime:/etc/localtime:ro
89               - logs:/var/log/kolla
90             environment:
91               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
92       host_prep_tasks:
93         - name: create /var/run/redis
94           file:
95             path: /var/run/redis
96             state: directory
97       upgrade_tasks:
98         - name: Stop and disable redis service
99           tags: step2
100           service: name=redis state=stopped enabled=no