openstack-ansible-rabbitmq_.../tasks/rabbitmq_ssl_key_distribute.yml
Matt Thompson c9773b9d9c Update SSL key / cert distribution
Currently, the key and cert files are not being distributed to
non-primary nodes.  This commit does the following:

- references the primary node in rabbitmq_ssl_key_distribute.yml when
  referencing the key and cert facts
- uses a slurp in rabbitmq_ssl_key_distribute.yml so we can get exact
  copies for the key / cert files (previously the files would get
  created without trailing newlines)
- adds some basic tests to ensure these files are consistent across
  the cluster
- removes unnecessary with_items loops in
  rabbitmq_ssl_key_distribute.yml

Change-Id: I98bcd17dac9a47cc19e0d9ec90176945a6d7e355
Co-Authored-By: Jesse Pretorius <jesse.pretorius@rackspace.co.uk>
2016-01-05 16:01:01 +00:00

59 lines
1.8 KiB
YAML

---
# Copyright 2015, 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: Distribute self signed ssl key
copy:
dest: "{{ rabbitmq_ssl_key }}"
content: "{{ hostvars[groups['rabbitmq_all'][0]]['rabbitmq_ssl_key_fact'] | b64decode }}"
owner: "rabbitmq"
group: "rabbitmq"
mode: "0640"
tags:
- rabbitmq-ssl
- name: Distribute self signed ssl cert
copy:
dest: "{{ rabbitmq_ssl_cert }}"
content: "{{ hostvars[groups['rabbitmq_all'][0]]['rabbitmq_ssl_cert_fact'] | b64decode }}"
owner: "rabbitmq"
group: "rabbitmq"
mode: "0640"
tags:
- rabbitmq-ssl
- name: Ensure rabbitmq user owns the self-signed key and certificate
file:
path: "{{ item }}"
owner: rabbitmq
group: rabbitmq
with_items:
- "{{ rabbitmq_ssl_key }}"
- "{{ rabbitmq_ssl_cert }}"
tags:
- rabbitmq-ssl
# This is here because there was a different way of configuring SSL/TLS
# for RabbitMQ that used a mode of 0750 for the RabbitMQ directory. That has
# since been updated but we need to ensure that old environments get this
# critical update during upgrades.
#
# See bug 1513668 in Launchpad for more details.
- name: Ensure /etc/rabbitmq is set to the default mode of 0755
file:
path: /etc/rabbitmq
mode: 0755
tags:
- rabbitmq-ssl