1 heat_template_version: pike
4 OpenStack containerized Rabbitmq service
10 DockerRabbitmqConfigImage:
11 description: The container image to use for the rabbitmq config_volume
15 description: Mapping of service endpoint -> protocol. Typically set
16 via parameter_defaults in the resource registry.
20 description: Dictionary packing service data
24 description: Mapping of service_name -> network name. Typically set
25 via parameter_defaults in the resource registry. This
26 mapping overrides those in ServiceNetMapDefaults.
37 description: Role name on which the service is applied
41 description: Parameters specific to the role
47 type: ../../../puppet/services/rabbitmq.yaml
49 EndpointMap: {get_param: EndpointMap}
50 ServiceData: {get_param: ServiceData}
51 ServiceNetMap: {get_param: ServiceNetMap}
52 DefaultPasswords: {get_param: DefaultPasswords}
53 RoleName: {get_param: RoleName}
54 RoleParameters: {get_param: RoleParameters}
58 description: Role data for the Rabbitmq API role.
60 service_name: {get_attr: [RabbitmqBase, role_data, service_name]}
63 - {get_attr: [RabbitmqBase, role_data, config_settings]}
64 - rabbitmq::service_manage: false
65 tripleo::profile::pacemaker::rabbitmq_bundle::rabbitmq_docker_image: &rabbitmq_image {get_param: DockerRabbitmqImage}
66 step_config: &step_config
67 get_attr: [RabbitmqBase, role_data, step_config]
68 service_config_settings: {get_attr: [RabbitmqBase, role_data, service_config_settings]}
69 # BEGIN DOCKER SETTINGS
71 config_volume: rabbitmq
73 step_config: *step_config
74 config_image: {get_param: DockerRabbitmqConfigImage}
76 /var/lib/kolla/config_files/rabbitmq.json:
77 command: /usr/sbin/pacemaker_remoted
79 - dest: /etc/libqb/force-filesystem-sockets
83 - source: "/var/lib/kolla/config_files/src/*"
86 preserve_properties: true
88 - path: /var/lib/rabbitmq
89 owner: rabbitmq:rabbitmq
91 - path: /var/log/rabbitmq
92 owner: rabbitmq:rabbitmq
94 # When using pacemaker we don't launch the container, instead that is done by pacemaker
100 image: *rabbitmq_image
104 - /var/lib/kolla/config_files/rabbitmq.json:/var/lib/kolla/config_files/config.json:ro
105 - /var/lib/config-data/puppet-generated/rabbitmq/:/var/lib/kolla/config_files/src:ro
106 - /etc/hosts:/etc/hosts:ro
107 - /etc/localtime:/etc/localtime:ro
108 - /var/lib/rabbitmq:/var/lib/rabbitmq
110 - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
111 - KOLLA_BOOTSTRAP=True
115 - - 'RABBITMQ_CLUSTER_COOKIE'
118 expression: $.data.passwords.where($ != '').first()
121 - {get_param: RabbitCookie}
122 - {get_param: [DefaultPasswords, rabbit_cookie]}
124 rabbitmq_init_bundle:
136 - - "cp -a /tmp/puppet-etc/* /etc/puppet; echo '{\"step\": 2}' > /etc/puppet/hieradata/docker.json"
137 - "FACTER_uuid=docker puppet apply --tags file,file_line,concat,augeas,TAGS -v -e 'CONFIG'"
139 TAGS: 'pacemaker::resource::bundle,pacemaker::property,pacemaker::resource::ocf,pacemaker::constraint::order,pacemaker::constraint::colocation'
140 CONFIG: 'include ::tripleo::profile::base::pacemaker;include ::tripleo::profile::pacemaker::rabbitmq_bundle'
141 image: *rabbitmq_image
143 - /etc/hosts:/etc/hosts:ro
144 - /etc/localtime:/etc/localtime:ro
145 - /etc/puppet:/tmp/puppet-etc:ro
146 - /usr/share/openstack-puppet/modules:/usr/share/openstack-puppet/modules:ro
147 - /etc/corosync/corosync.conf:/etc/corosync/corosync.conf:ro
148 - /dev/shm:/dev/shm:rw
150 - name: create /var/lib/rabbitmq
152 path: /var/lib/rabbitmq
154 - name: stop the Erlang port mapper on the host and make sure it cannot bind to the port used by container
156 echo 'export ERL_EPMD_ADDRESS=127.0.0.1' > /etc/rabbitmq/rabbitmq-env.conf
157 echo 'export ERL_EPMD_PORT=4370' >> /etc/rabbitmq/rabbitmq-env.conf
158 for pid in $(pgrep epmd); do if [ "$(lsns -o NS -p $pid)" == "$(lsns -o NS -p 1)" ]; then kill $pid; break; fi; done
160 - name: get bootstrap nodeid
162 command: hiera -c /etc/puppet/hiera.yaml bootstrap_nodeid
163 register: bootstrap_node
164 - name: set is_bootstrap_node fact
166 set_fact: is_bootstrap_node={{bootstrap_node.stdout|lower == ansible_hostname|lower}}
167 - name: Disable the rabbitmq cluster resource.
170 resource: {get_attr: [RabbitmqBase, role_data, service_name]}
172 wait_for_resource: true
173 when: is_bootstrap_node
174 - name: Delete the stopped rabbitmq cluster resource.
177 resource: {get_attr: [RabbitmqBase, role_data, service_name]}
179 wait_for_resource: true
180 when: is_bootstrap_node
181 - name: Disable rabbitmq service
183 service: name=rabbitmq-server enabled=no