Add sample usage of StorageMgmt network for compute nodes
[apex-tripleo-heat-templates.git] / docker / services / database / redis.yaml
1 heat_template_version: pike
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     type: json
37
38 resources:
39
40   RedisBase:
41     type: ../../../puppet/services/database/redis.yaml
42     properties:
43       EndpointMap: {get_param: EndpointMap}
44       ServiceNetMap: {get_param: ServiceNetMap}
45       DefaultPasswords: {get_param: DefaultPasswords}
46
47 outputs:
48   role_data:
49     description: Role data for the Redis API role.
50     value:
51       service_name: {get_attr: [RedisBase, role_data, service_name]}
52       config_settings:
53         map_merge:
54           - {get_attr: [RedisBase, role_data, config_settings]}
55           - redis::daemonize: false
56       step_config: &step_config
57         get_attr: [RedisBase, role_data, step_config]
58       service_config_settings: {get_attr: [RedisBase, role_data, service_config_settings]}
59       # BEGIN DOCKER SETTINGS
60       puppet_config:
61         config_volume: 'redis'
62         # NOTE: we need the exec tag to copy /etc/redis.conf.puppet to
63         # /etc/redis.conf
64         # https://github.com/arioch/puppet-redis/commit/1c004143223e660cbd433422ff8194508aab9763
65         puppet_tags: 'exec'
66         step_config: *step_config
67         config_image: &redis_image
68           list_join:
69             - '/'
70             - [ {get_param: DockerNamespace}, {get_param: DockerRedisImage} ]
71       kolla_config:
72         /var/lib/kolla/config_files/redis.json:
73           command: /usr/bin/redis-server /etc/redis.conf
74           permissions:
75             - path: /var/run/redis
76               owner: redis:redis
77               recurse: true
78       docker_config:
79         step_1:
80           redis_init_logs:
81             start_order: 0
82             detach: false
83             image: *redis_image
84             privileged: false
85             user: root
86             volumes:
87               - /var/log/containers/redis:/var/log/redis
88             command: ['/bin/bash', '-c', 'chown -R redis:redis /var/log/redis']
89           redis:
90             start_order: 1
91             image: *redis_image
92             net: host
93             privileged: false
94             restart: always
95             volumes:
96               - /run:/run
97               - /var/lib/kolla/config_files/redis.json:/var/lib/kolla/config_files/config.json:ro
98               - /var/lib/config-data/redis/etc/redis.conf:/etc/redis.conf:ro
99               - /etc/localtime:/etc/localtime:ro
100               - /var/log/containers/redis:/var/log/redis
101             environment:
102               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
103       host_prep_tasks:
104         - name: create persistent directories
105           file:
106             path: "{{ item }}"
107             state: directory
108           with_items:
109             - /var/log/containers/redis
110             - /var/run/redis
111       upgrade_tasks:
112         - name: Stop and disable redis service
113           tags: step2
114           service: name=redis state=stopped enabled=no