Enable Neutron LBaaS Integration
[apex-tripleo-heat-templates.git] / docker / services / pacemaker / 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       RoleName: {get_param: RoleName}
51       RoleParameters: {get_param: RoleParameters}
52
53 outputs:
54   role_data:
55     description: Role data for the Redis API role.
56     value:
57       service_name: {get_attr: [RedisBase, role_data, service_name]}
58       config_settings:
59         map_merge:
60           - {get_attr: [RedisBase, role_data, config_settings]}
61           - redis::service_manage: false
62             redis::notify_service: false
63             redis::managed_by_cluster_manager: true
64             tripleo::profile::pacemaker::database::redis_bundle::redis_docker_image: &redis_image
65               list_join:
66                 - '/'
67                 - - {get_param: DockerNamespace}
68                   - {get_param: DockerRedisImage}
69
70       step_config: ""
71       service_config_settings: {get_attr: [RedisBase, role_data, service_config_settings]}
72       # BEGIN DOCKER SETTINGS
73       puppet_config:
74         config_volume: 'redis'
75         # NOTE: we need the exec tag to copy /etc/redis.conf.puppet to
76         # /etc/redis.conf
77         # https://github.com/arioch/puppet-redis/commit/1c004143223e660cbd433422ff8194508aab9763
78         puppet_tags: 'exec'
79         step_config:
80           get_attr: [RedisBase, role_data, step_config]
81         config_image: &redis_config_image
82           list_join:
83             - '/'
84             - [ {get_param: DockerNamespace}, {get_param: DockerRedisConfigImage} ]
85       kolla_config:
86         /var/lib/kolla/config_files/redis.json:
87           command: /usr/sbin/pacemaker_remoted
88           config_files:
89             - dest: /etc/libqb/force-filesystem-sockets
90               source: /dev/null
91               owner: root
92               perm: '0644'
93             - source: "/var/lib/kolla/config_files/src/*"
94               dest: "/"
95               merge: true
96               preserve_properties: true
97               optional: true
98           permissions:
99             - path: /var/run/redis
100               owner: redis:redis
101               recurse: true
102             - path: /var/lib/redis
103               owner: redis:redis
104               recurse: true
105             - path: /var/log/redis
106               owner: redis:redis
107               recurse: true
108       docker_config:
109         step_2:
110           redis_init_bundle:
111             start_order: 2
112             detach: false
113             net: host
114             user: root
115             config_volume: 'redis_init_bundle'
116             command:
117               - '/bin/bash'
118               - '-c'
119               - str_replace:
120                   template:
121                     list_join:
122                       - '; '
123                       - - "cp -a /tmp/puppet-etc/* /etc/puppet; echo '{\"step\": 2}' > /etc/puppet/hieradata/docker.json"
124                         - "FACTER_uuid=docker puppet apply --tags file,file_line,concat,augeas,TAGS -v -e 'CONFIG'"
125                   params:
126                     TAGS: 'pacemaker::resource::bundle,pacemaker::property,pacemaker::resource::ocf,pacemaker::constraint::order,pacemaker::constraint::colocation'
127                     CONFIG: 'include ::tripleo::profile::base::pacemaker;include ::tripleo::profile::pacemaker::database::redis_bundle'
128             image: *redis_config_image
129             volumes:
130               - /etc/hosts:/etc/hosts:ro
131               - /etc/localtime:/etc/localtime:ro
132               - /etc/puppet:/tmp/puppet-etc:ro
133               - /usr/share/openstack-puppet/modules:/usr/share/openstack-puppet/modules:ro
134               - /etc/corosync/corosync.conf:/etc/corosync/corosync.conf:ro
135               - /dev/shm:/dev/shm:rw
136       host_prep_tasks:
137         - name: create /var/run/redis
138           file:
139             path: /var/run/redis
140             state: directory
141         - name: create /var/log/redis
142           file:
143             path: /var/log/redis
144             state: directory
145         - name: create /var/lib/redis
146           file:
147             path: /var/lib/redis
148             state: directory
149       upgrade_tasks:
150         - name: Stop and disable redis service
151           tags: step2
152           service: name=redis state=stopped enabled=no