Change flat network name for nosdn fdio scenario
[apex-tripleo-heat-templates.git] / puppet / services / rabbitmq.yaml
1 heat_template_version: pike
2
3 description: >
4   RabbitMQ 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   RabbitUserName:
34     default: guest
35     description: The username for RabbitMQ
36     type: string
37   RabbitPassword:
38     description: The password for RabbitMQ
39     type: string
40     hidden: true
41   RabbitFDLimit:
42     default: 65536
43     description: Configures RabbitMQ FD limit
44     type: number
45   RabbitIPv6:
46     default: false
47     description: Enable IPv6 in RabbitMQ
48     type: boolean
49   RabbitCookie:
50     type: string
51     default: ''
52     hidden: true
53   RabbitHAQueues:
54     description:
55       The number of HA queues to be configured in rabbit. The default is -1 which
56       translates to "ha-mode all". The special value 0 will be automatically
57       overridden to CEIL(N/2) where N is the number of nodes running rabbitmq.
58     default: -1
59     type: number
60   MonitoringSubscriptionRabbitmq:
61     default: 'overcloud-rabbitmq'
62     type: string
63   EnableInternalTLS:
64     type: boolean
65     default: false
66
67 conditions:
68   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
69
70 outputs:
71   role_data:
72     description: Role data for the RabbitMQ role.
73     value:
74       service_name: rabbitmq
75       monitoring_subscription: {get_param: MonitoringSubscriptionRabbitmq}
76       config_settings:
77         map_merge:
78           -
79             rabbitmq::file_limit: {get_param: RabbitFDLimit}
80             rabbitmq::default_user: {get_param: RabbitUserName}
81             rabbitmq::default_pass: {get_param: RabbitPassword}
82             rabbit_ipv6: {get_param: RabbitIPv6}
83             tripleo.rabbitmq.firewall_rules:
84               '109 rabbitmq':
85                 dport:
86                   - 4369
87                   - 5672
88                   - 25672
89             rabbitmq::delete_guest_user: false
90             rabbitmq::wipe_db_on_cookie_change: true
91             rabbitmq::port: 5672
92             rabbitmq::package_provider: yum
93             rabbitmq::package_source: undef
94             rabbitmq::repos_ensure: false
95             rabbitmq::tcp_keepalive: true
96             rabbitmq_environment:
97               NODE_PORT: ''
98               NODE_IP_ADDRESS: ''
99               RABBITMQ_NODENAME: "rabbit@%{::hostname}"
100               RABBITMQ_SERVER_ERL_ARGS: '"+K true +P 1048576 -kernel inet_default_connect_options [{nodelay,true},{raw,6,18,<<15000:64/native>>}] -kernel inet_default_listen_options [{raw,6,18,<<15000:64/native>>}]"'
101               'export ERL_EPMD_ADDRESS': "%{hiera('rabbitmq::interface')}"
102             rabbitmq_kernel_variables:
103               inet_dist_listen_min: '25672'
104               inet_dist_listen_max: '25672'
105             rabbitmq_config_variables:
106               cluster_partition_handling: 'pause_minority'
107               queue_master_locator: '<<"min-masters">>'
108               loopback_users: '[]'
109             rabbitmq::erlang_cookie:
110               yaql:
111                 expression: $.data.passwords.where($ != '').first()
112                 data:
113                   passwords:
114                     - {get_param: RabbitCookie}
115                     - {get_param: [DefaultPasswords, rabbit_cookie]}
116             # NOTE: bind IP is found in Heat replacing the network name with the
117             # local node IP for the given network; replacement examples
118             # (eg. for internal_api):
119             # internal_api -> IP
120             # internal_api_uri -> [IP]
121             # internal_api_subnet - > IP/CIDR
122             rabbitmq::interface: {get_param: [ServiceNetMap, RabbitmqNetwork]}
123             rabbitmq::nr_ha_queues: {get_param: RabbitHAQueues}
124             rabbitmq::ssl: {get_param: EnableInternalTLS}
125             rabbitmq::ssl_erl_dist: {get_param: EnableInternalTLS}
126             rabbitmq::ssl_port: 5672
127             rabbitmq::ssl_depth: 1
128             rabbitmq::ssl_only: {get_param: EnableInternalTLS}
129             rabbitmq::ssl_interface: {get_param: [ServiceNetMap, RabbitmqNetwork]}
130             # TODO(jaosorior): Remove this once we set a proper default in
131             # puppet-tripleo
132             tripleo::profile::base::rabbitmq::enable_internal_tls: {get_param: EnableInternalTLS}
133           -
134             if:
135             - internal_tls_enabled
136             - generate_service_certificates: true
137               tripleo::profile::base::rabbitmq::certificate_specs:
138                 service_certificate: '/etc/pki/tls/certs/rabbitmq.crt'
139                 service_key: '/etc/pki/tls/private/rabbitmq.key'
140                 hostname:
141                   str_replace:
142                     template: "%{hiera('fqdn_NETWORK')}"
143                     params:
144                       NETWORK: {get_param: [ServiceNetMap, RabbitmqNetwork]}
145                 principal:
146                   str_replace:
147                     template: "rabbitmq/%{hiera('fqdn_NETWORK')}"
148                     params:
149                       NETWORK: {get_param: [ServiceNetMap, RabbitmqNetwork]}
150             - {}
151       step_config: |
152         include ::tripleo::profile::base::rabbitmq
153       upgrade_tasks:
154         - name: Stop rabbitmq service
155           tags: step2
156           service: name=rabbitmq-server state=stopped
157         - name: Start rabbitmq service
158           tags: step4
159           service: name=rabbitmq-server state=started
160       metadata_settings:
161         if:
162           - internal_tls_enabled
163           -
164             - service: rabbitmq
165               network: {get_param: [ServiceNetMap, RabbitmqNetwork]}
166               type: node
167           - null