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