Change flat network name for nosdn fdio scenario
[apex-tripleo-heat-templates.git] / puppet / services / database / redis.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack Redis service configured with Puppet
5
6 parameters:
7   ServiceData:
8     default: {}
9     description: Dictionary packing service data
10     type: json
11   ServiceNetMap:
12     default: {}
13     description: Mapping of service_name -> network name. Typically set
14                  via parameter_defaults in the resource registry.  This
15                  mapping overrides those in ServiceNetMapDefaults.
16     type: json
17   DefaultPasswords:
18     default: {}
19     type: json
20   RoleName:
21     default: ''
22     description: Role name on which the service is applied
23     type: string
24   RoleParameters:
25     default: {}
26     description: Parameters specific to the role
27     type: json
28   EndpointMap:
29     default: {}
30     description: Mapping of service endpoint -> protocol. Typically set
31                  via parameter_defaults in the resource registry.
32     type: json
33   EnableInternalTLS:
34     type: boolean
35     default: false
36
37 conditions:
38   use_tls_proxy: {equals : [{get_param: EnableInternalTLS}, true]}
39
40 resources:
41
42   RedisBase:
43     type: ./redis-base.yaml
44     properties:
45       ServiceData: {get_param: ServiceData}
46       ServiceNetMap: {get_param: ServiceNetMap}
47       DefaultPasswords: {get_param: DefaultPasswords}
48       EndpointMap: {get_param: EndpointMap}
49       RoleName: {get_param: RoleName}
50       RoleParameters: {get_param: RoleParameters}
51       EnableInternalTLS: {get_param: EnableInternalTLS}
52
53 outputs:
54   role_data:
55     description: Role data for the redis role.
56     value:
57       service_name: redis
58       config_settings:
59         map_merge:
60           - get_attr: [RedisBase, role_data, config_settings]
61           - tripleo.redis.firewall_rules:
62               '108 redis':
63                 dport:
64                   - 6379
65                   - 26379
66             tripleo::profile::base::database::redis::tls_proxy_bind_ip:
67               get_param: [ServiceNetMap, RedisNetwork]
68             tripleo::profile::base::database::redis::tls_proxy_fqdn:
69               str_replace:
70                 template:
71                   "%{hiera('fqdn_$NETWORK')}"
72                 params:
73                   $NETWORK: {get_param: [ServiceNetMap, RedisNetwork]}
74             tripleo::profile::base::database::redis::tls_proxy_port: 6379
75           - if:
76             - use_tls_proxy
77             - redis_certificate_specs:
78                 service_certificate: '/etc/pki/tls/certs/redis.crt'
79                 service_key: '/etc/pki/tls/private/redis.key'
80                 hostname:
81                   str_replace:
82                     template: "%{hiera('cloud_name_NETWORK')}"
83                     params:
84                       NETWORK: {get_param: [ServiceNetMap, RedisNetwork]}
85                 principal:
86                   str_replace:
87                     template: "redis/%{hiera('cloud_name_NETWORK')}"
88                     params:
89                       NETWORK: {get_param: [ServiceNetMap, RedisNetwork]}
90             - {}
91       step_config: |
92         include ::tripleo::profile::base::database::redis
93       metadata_settings:
94         if:
95           - use_tls_proxy
96           -
97             - service: redis
98               network: {get_param: [ServiceNetMap, RabbitmqNetwork]}
99               type: vip
100           - null
101       upgrade_tasks:
102         - name: Check if redis is deployed
103           command: systemctl is-enabled redis
104           tags: common
105           ignore_errors: True
106           register: redis_enabled
107         - name: "PreUpgrade step0,validation: Check if redis is running"
108           shell: >
109             /usr/bin/systemctl show 'redis' --property ActiveState |
110             grep '\bactive\b'
111           when: redis_enabled.rc == 0
112           tags: step0,validation
113         - name: Stop redis service
114           tags: step1
115           when: redis_enabled.rc == 0
116           service: name=redis state=stopped
117         - name: Install redis package if it was disabled
118           tags: step3
119           yum: name=redis state=latest
120           when: redis_enabled.rc != 0
121         - name: Start redis service
122           tags: step4
123           service: name=redis state=started