Merge "Check and set cookie without using a failed task"

This commit is contained in:
Zuul 2017-11-27 17:21:45 +00:00 committed by Gerrit Code Review
commit 555015e3ca
2 changed files with 17 additions and 27 deletions

View File

@ -58,6 +58,7 @@
- include: rabbitmq_set_cookie.yml - include: rabbitmq_set_cookie.yml
tags: tags:
- rabbitmq_server-config - rabbitmq_server-config
- rabbitmq-config
- include: rabbitmq_post_install.yml - include: rabbitmq_post_install.yml
tags: tags:

View File

@ -13,33 +13,22 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- block: - name: Set rabbit cookie
- name: Read rabbit cookie copy:
slurp: content: "{{ rabbitmq_cookie_token }}"
src: /var/lib/rabbitmq/.erlang.cookie dest: /var/lib/rabbitmq/.erlang.cookie
register: tmp_rabbit_cookie mode: "0400"
failed_when: (tmp_rabbit_cookie.content | b64decode).find(rabbitmq_cookie_token) == -1 owner: rabbitmq
tags: group: rabbitmq
- rabbitmq-config register: cookie_set
rescue: - include: rabbitmq_stopped.yml
- include: rabbitmq_stopped.yml static: no
static: no when:
tags: - cookie_set | changed
- rabbitmq-config
- name: Set rabbit cookie - include: rabbitmq_started.yml
copy: static: no
content: "{{ rabbitmq_cookie_token }}" when:
dest: /var/lib/rabbitmq/.erlang.cookie - cookie_set | changed
mode: "0400"
owner: rabbitmq
group: rabbitmq
register: cookie_set
tags:
- rabbitmq-config
- include: rabbitmq_started.yml
static: no
tags:
- rabbitmq-config