
This adopts old functional tests to be launched with molecule. Patch does not intend to extend or refactor set of existing tests, but to provide a baseline to iterate on and ability to improve coverage with important usecases. Change-Id: Ia93b5adb313d5b930086ce90dafe6a63da092aba Signed-off-by: Dmitriy Rabotyagov <dmitriy.rabotyagov@cleura.com>
94 lines
2.8 KiB
YAML
94 lines
2.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.
|
|
|
|
# NOTE(cloudnull):
|
|
# While the haproxy distro packages provide for an haproxy
|
|
# group this group is being created upfront to support
|
|
# log aggregation links as well as ensure common user
|
|
# functionality across various distros that we support.
|
|
- name: Create the haproxy system group
|
|
ansible.builtin.group:
|
|
name: "haproxy"
|
|
state: "present"
|
|
system: "yes"
|
|
tags:
|
|
- haproxy-group
|
|
|
|
# NOTE(cloudnull):
|
|
# While the haproxy distro packages provide for an haproxy
|
|
# user this user is being created upfront to support
|
|
# log aggregation links as well as ensure common user
|
|
# functionality across various distros that we support.
|
|
- name: Create the haproxy system user
|
|
ansible.builtin.user:
|
|
name: "haproxy"
|
|
group: "haproxy"
|
|
comment: "haproxy user"
|
|
shell: "/bin/false"
|
|
system: "yes"
|
|
createhome: "yes"
|
|
home: "/var/lib/haproxy"
|
|
tags:
|
|
- haproxy-user
|
|
|
|
- name: Create haproxy config directories
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
mode: "0755"
|
|
owner: root
|
|
group: root
|
|
with_items:
|
|
- /etc/haproxy/conf.d
|
|
- "{{ haproxy_ssl_cert_path }}"
|
|
- "{{ haproxy_ssl_temp_path }}"
|
|
|
|
- name: Cleanup haproxy_ssl_cert_path if temp_path is used
|
|
when: "haproxy_ssl_cert_path != haproxy_ssl_temp_path"
|
|
block:
|
|
- name: Find crt and key files in the cert_path
|
|
ansible.builtin.find:
|
|
paths: "{{ haproxy_ssl_cert_path }}"
|
|
patterns: '*.crt,*.key'
|
|
register: old_certs
|
|
|
|
- name: Copy cert files to the temp_path
|
|
vars:
|
|
filename: "{{ item | basename }}"
|
|
ansible.builtin.copy:
|
|
remote_src: true
|
|
src: "{{ item }}"
|
|
dest: "{{ [haproxy_ssl_temp_path, filename] | path_join }}"
|
|
mode: "0644"
|
|
loop: "{{ old_certs['files'] | map(attribute='path') }}"
|
|
|
|
- name: Remove file from the old place
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: absent
|
|
loop: "{{ old_certs['files'] | map(attribute='path') }}"
|
|
|
|
- name: Copy static files
|
|
ansible.builtin.copy:
|
|
content: "{{ item.content }}"
|
|
dest: "{{ item.dest }}"
|
|
mode: "0644"
|
|
owner: haproxy
|
|
group: haproxy
|
|
when:
|
|
- (item.condition | default(True))
|
|
loop: "{{ haproxy_static_files }}"
|
|
no_log: true
|