openstack-ansible-galera_cl.../tasks/galera_client_ssl.yml
Jimmy McCrory 5d2988c938 Fix SSL cert distribution tasks
The 'galera_cluster_members' variable has been added, matching the
default value from the galera_server role and used by the
'galera_ssl_ca_cert' variable to find a galera node within the inventory
to attempt to pull cert files from.

Since the slurp task that checks for an existing CA cert file is set to
never fail, the debug message should check if any content was found. The
changed_when can also be removed since slurp tasks only return 'ok'
when a file is found.

The task copying an existing cert from a server was using a 'src'
argument where it should be 'dest'.

Change-Id: I95cc994df5118fce7ce588fc0bff979bc283a6f3
2017-12-13 15:10:51 -08:00

54 lines
1.6 KiB
YAML

---
# Copyright 2017, 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: Get Galera ssl CA cert contents
slurp:
src: "{{ galera_ssl_ca_cert }}"
register: galera_ca
failed_when: false
delegate_to: "{{ galera_ssl_server }}"
when:
- galera_user_ssl_ca_cert is not defined
- name: Check for Galera ssl CA cert get failure
debug:
msg: >
The cert retrieval task failed or no CA cert was found. Check the file
"{{ galera_ssl_ca_cert }}" on server "{{ galera_ssl_server }}" before
trying again.
when:
- galera_ca.content is not defined
- name: Distribute Galera ssl CA cert (SERVER)
copy:
content: "{{ galera_ca.content | b64decode }}"
dest: "{{ galera_ssl_ca_cert }}"
owner: "root"
group: "root"
mode: "0644"
when:
- galera_user_ssl_ca_cert is not defined
- galera_ca.content is defined
- name: Distribute Galera ssl CA cert (USER)
copy:
src: "{{ galera_user_ssl_ca_cert }}"
dest: "{{ galera_ssl_ca_cert }}"
owner: "root"
group: "root"
mode: "0644"
when:
- galera_user_ssl_ca_cert is defined