Merge "Add README to ci/environments directory"
[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   DockerRedisConfigImage:
16     description: The container image to use for the redis config_volume
17     default: 'centos-binary-redis:latest'
18     type: string
19   EndpointMap:
20     default: {}
21     description: Mapping of service endpoint -> protocol. Typically set
22                  via parameter_defaults in the resource registry.
23     type: json
24   ServiceNetMap:
25     default: {}
26     description: Mapping of service_name -> network name. Typically set
27                  via parameter_defaults in the resource registry.  This
28                  mapping overrides those in ServiceNetMapDefaults.
29     type: json
30   DefaultPasswords:
31     default: {}
32     type: json
33   RoleName:
34     default: ''
35     description: Role name on which the service is applied
36     type: string
37   RoleParameters:
38     default: {}
39     description: Parameters specific to the role
40     type: json
41
42 resources:
43
44   RedisBase:
45     type: ../../../puppet/services/database/redis.yaml
46     properties:
47       EndpointMap: {get_param: EndpointMap}
48       ServiceNetMap: {get_param: ServiceNetMap}
49       DefaultPasswords: {get_param: DefaultPasswords}
50
51 outputs:
52   role_data:
53     description: Role data for the Redis API role.
54     value:
55       service_name: {get_attr: [RedisBase, role_data, service_name]}
56       config_settings:
57         map_merge:
58           - {get_attr: [RedisBase, role_data, config_settings]}
59           - redis::daemonize: false
60       step_config: &step_config
61         get_attr: [RedisBase, role_data, step_config]
62       service_config_settings: {get_attr: [RedisBase, role_data, service_config_settings]}
63       # BEGIN DOCKER SETTINGS
64       puppet_config:
65         config_volume: 'redis'
66         # NOTE: we need the exec tag to copy /etc/redis.conf.puppet to
67         # /etc/redis.conf
68         # https://github.com/arioch/puppet-redis/commit/1c004143223e660cbd433422ff8194508aab9763
69         puppet_tags: 'exec'
70         step_config: *step_config
71         config_image:
72           list_join:
73             - '/'
74             - [ {get_param: DockerNamespace}, {get_param: DockerRedisConfigImage} ]
75       kolla_config:
76         /var/lib/kolla/config_files/redis.json:
77           command: /usr/bin/redis-server /etc/redis.conf
78           permissions:
79             - path: /var/run/redis
80               owner: redis:redis
81               recurse: true
82       docker_config:
83         step_1:
84           redis_init_logs:
85             start_order: 0
86             detach: false
87             image: &redis_image
88               list_join:
89                 - '/'
90                 - [ {get_param: DockerNamespace}, {get_param: DockerRedisImage} ]
91             privileged: false
92             user: root
93             volumes:
94               - /var/log/containers/redis:/var/log/redis
95             command: ['/bin/bash', '-c', 'chown -R redis:redis /var/log/redis']
96           redis:
97             start_order: 1
98             image: *redis_image
99             net: host
100             privileged: false
101             restart: always
102             volumes:
103               - /run:/run
104               - /var/lib/kolla/config_files/redis.json:/var/lib/kolla/config_files/config.json:ro
105               - /var/lib/config-data/redis/etc/redis.conf:/etc/redis.conf:ro
106               - /etc/localtime:/etc/localtime:ro
107               - /var/log/containers/redis:/var/log/redis
108             environment:
109               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
110       host_prep_tasks:
111         - name: create persistent directories
112           file:
113             path: "{{ item }}"
114             state: directory
115           with_items:
116             - /var/log/containers/redis
117             - /var/run/redis
118       upgrade_tasks:
119         - name: Stop and disable redis service
120           tags: step2
121           service: name=redis state=stopped enabled=no