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.
|
|
|
|
- name: Playbook for role testing
|
|
hosts: localhost
|
|
connection: local
|
|
user: root
|
|
become: true
|
|
pre_tasks:
|
|
- include: "common/common-tasks/test-set-nodepool-vars.yml"
|
|
# These directories are removed because the gate job has them in
|
|
# the base image.
|
|
- name: Remove local mysql directories if they exist
|
|
file:
|
|
path: "{{ item.path }}"
|
|
state: "absent"
|
|
with_items:
|
|
- { path: "/etc/mysql" }
|
|
- { path: "/etc/mysql/conf.d" }
|
|
- { path: "/usr/lib/galera" }
|
|
- { path: "/etc/my.cnf.d" }
|
|
- { path: "/etc/my.cnf" }
|
|
roles:
|
|
- role: "galera_client"
|
|
galera_address: "10.0.0.1"
|
|
galera_root_password: secrete
|
|
galera_root_user: root
|
|
galera_client_drop_config_file: false
|
|
post_tasks:
|
|
- name: Check that the mysql command is present
|
|
find:
|
|
paths: "{{ ansible_env.PATH | regex_replace(':',',') }}"
|
|
patterns: "mysql"
|
|
register: mysql
|
|
- name: Check .my.cnf existence
|
|
stat:
|
|
path: /root/.my.cnf
|
|
register: mycnf
|
|
- name: mysql command should exist and client config file .my.cnf should not
|
|
assert:
|
|
that:
|
|
- "mysql.matched > 0"
|
|
- "not mycnf.stat.exists"
|
|
|
|
- name: Playbook for role testing
|
|
hosts: localhost
|
|
connection: local
|
|
user: root
|
|
become: true
|
|
pre_tasks:
|
|
- name: Remove local mysql directories if they exist
|
|
file:
|
|
path: "{{ item.path }}"
|
|
state: "absent"
|
|
with_items:
|
|
- { path: "/etc/mysql" }
|
|
- { path: "/etc/mysql/conf.d" }
|
|
- { path: "/usr/lib/galera" }
|
|
- { path: "/etc/my.cnf.d" }
|
|
- { path: "/etc/my.cnf" }
|
|
roles:
|
|
- role: "galera_client"
|
|
galera_address: "10.0.0.1"
|
|
galera_root_password: secrete
|
|
galera_root_user: root
|
|
galera_client_drop_config_file: true
|
|
post_tasks:
|
|
- name: Check that the mysql command is present
|
|
find:
|
|
paths: "{{ ansible_env.PATH | regex_replace(':',',') }}"
|
|
patterns: "mysql"
|
|
register: mysql
|
|
- name: Check .my.cnf existence
|
|
stat:
|
|
path: /root/.my.cnf
|
|
register: mycnf
|
|
- name: mysql command and client config file .my.cnf should exist
|
|
assert:
|
|
that:
|
|
- "mysql.matched > 0"
|
|
- "mycnf.stat.exists"
|