/home/zuul/src/opendev.org/openstack/ansible-role-qdrouterd/tasks/qdrouterd_ssl_user_provided.yml
---
# Copyright 2018, Red Hat, 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.

# If we have a user-provided SSL certificate from
# /etc/openstack_deploy/user_variables.yml, we should deploy that certificate
# and key to each Qdrouterd container.
- name: Deploy user provided ssl cert
  copy:
    src: "{{ qdrouterd_user_ssl_cert }}"
    dest: "{{ qdrouterd_ssl_cert }}"
    owner: "qdrouterd"
    group: "qdrouterd"
    mode: "0644"
  when: qdrouterd_user_ssl_cert is defined
  tags:
    - qdrouterd-configs
    - qdrouterd-ssl

- name: Deploy user provided ssl key
  copy:
    src: "{{ qdrouterd_user_ssl_key }}"
    dest: "{{ qdrouterd_ssl_key }}"
    owner: "qdrouterd"
    group: "qdrouterd"
    mode: "0600"
  when: qdrouterd_user_ssl_key is defined
  tags:
    - qdrouterd-configs
    - qdrouterd-ssl

# Deploy the user provided CA certificate as well (if the user defined it
# within /etc/openstack_deploy/user_variables.yml).
- name: Deploy user provided ssl CA cert
  copy:
    src: "{{ qdrouterd_user_ssl_ca_cert }}"
    dest: "{{ qdrouterd_ssl_ca_cert }}"
    owner: "qdrouterd"
    group: "qdrouterd"
    mode: "0644"
  when: qdrouterd_user_ssl_ca_cert is defined
  tags:
    - qdrouterd-configs
    - qdrouterd-ssl