openstack-ansible-rabbitmq_.../tasks/rabbitmq_set_cookie.yml
Jesse Pretorius b9205e8313 Check and set cookie without using a failed task
Currently the checking of the cookie content uses
a try/rescue block and for a new install always
results in a failed task. This causes a lot of
confusion due to the failed task report.

This patch improves the process by executing the
stop/start if the cookie file is changed in any
way by the copy task. This is far simpler and
results in no task fails.

As all the tasks related to this were marked
rabbitmq-config the tag implementation is set
in the main tasks file and removed from all the
individual tasks.

Change-Id: Iba959f730f2453bf9a295158749b96ed3a966ef4
2017-11-24 14:08:23 +00:00

35 lines
951 B
YAML

---
# Copyright 2014, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Set rabbit cookie
copy:
content: "{{ rabbitmq_cookie_token }}"
dest: /var/lib/rabbitmq/.erlang.cookie
mode: "0400"
owner: rabbitmq
group: rabbitmq
register: cookie_set
- include: rabbitmq_stopped.yml
static: no
when:
- cookie_set | changed
- include: rabbitmq_started.yml
static: no
when:
- cookie_set | changed