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