Merge "Ansible 2.1.1 role testing"
This commit is contained in:
@@ -13,15 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
- name: Install galera server
|
bridges:
|
||||||
hosts: galera_test_hosts
|
- "br-mgmt"
|
||||||
serial: 1
|
|
||||||
user: root
|
ansible_python_interpreter: "/usr/bin/python2"
|
||||||
gather_facts: true
|
|
||||||
pre_tasks:
|
|
||||||
- debug:
|
|
||||||
msg: "{{ message }}"
|
|
||||||
roles:
|
|
||||||
- role: "{{ rolename | basename }}"
|
|
||||||
vars_files:
|
|
||||||
- test-vars.yml
|
|
||||||
@@ -1,13 +1,15 @@
|
|||||||
[all]
|
[all]
|
||||||
localhost ansible_connection=local ansible_become=True
|
localhost ansible_become=True
|
||||||
container1 ansible_ssh_host=10.100.100.101 ansible_host=10.100.100.101 ansible_become=True ansible_user=root
|
container1 ansible_ssh_host=10.100.100.101 ansible_host=10.100.100.101 ansible_become=True ansible_user=root
|
||||||
container2 ansible_ssh_host=10.100.100.102 ansible_host=10.100.100.102 ansible_become=True ansible_user=root
|
container2 ansible_ssh_host=10.100.100.102 ansible_host=10.100.100.102 ansible_become=True ansible_user=root
|
||||||
container3 ansible_ssh_host=10.100.100.103 ansible_host=10.100.100.103 ansible_become=True ansible_user=root
|
container3 ansible_ssh_host=10.100.100.103 ansible_host=10.100.100.103 ansible_become=True ansible_user=root
|
||||||
|
|
||||||
[galera_test_hosts]
|
[galera_all]
|
||||||
container1
|
container1
|
||||||
container2
|
container2
|
||||||
container3
|
container3
|
||||||
|
|
||||||
[all_containers:children]
|
[all_containers]
|
||||||
galera_test_hosts
|
container1
|
||||||
|
container2
|
||||||
|
container3
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
- name: Run functional tests
|
- name: Run functional tests
|
||||||
hosts: galera_test_hosts
|
hosts: galera_all
|
||||||
user: root
|
user: root
|
||||||
gather_facts: true
|
gather_facts: true
|
||||||
tasks:
|
tasks:
|
||||||
@@ -73,4 +73,4 @@
|
|||||||
- "%"
|
- "%"
|
||||||
when: ansible_ssh_host == '10.100.100.102'
|
when: ansible_ssh_host == '10.100.100.102'
|
||||||
vars_files:
|
vars_files:
|
||||||
- test-vars.yml
|
- playbooks/test-vars.yml
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
---
|
|
||||||
# Copyright 2016, 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: Create test containers
|
|
||||||
hosts: all_containers
|
|
||||||
gather_facts: false
|
|
||||||
pre_tasks:
|
|
||||||
- name: Destroy test containers
|
|
||||||
lxc_container:
|
|
||||||
name: "{{ container_name }}"
|
|
||||||
state: "absent"
|
|
||||||
delegate_to: "{{ physical_host }}"
|
|
||||||
tags:
|
|
||||||
- container-destroy
|
|
||||||
- name: Destroy container service directories
|
|
||||||
file:
|
|
||||||
path: "{{ item }}"
|
|
||||||
state: "absent"
|
|
||||||
with_items:
|
|
||||||
- "/openstack/{{ container_name }}"
|
|
||||||
- "/openstack/backup/{{ container_name }}"
|
|
||||||
- "/openstack/log/{{ container_name }}"
|
|
||||||
- "/var/lib/lxc/{{ container_name }}"
|
|
||||||
- "{{ lxc_container_directory|default('/var/lib/lxc') }}/{{ container_name }}"
|
|
||||||
delegate_to: "{{ physical_host }}"
|
|
||||||
tags:
|
|
||||||
- container-directories
|
|
||||||
roles:
|
|
||||||
- role: "lxc_container_create"
|
|
||||||
lxc_container_release: trusty
|
|
||||||
lxc_container_backing_store: dir
|
|
||||||
global_environment_variables:
|
|
||||||
PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
|
||||||
post_tasks:
|
|
||||||
- name: Wait for ssh to be available
|
|
||||||
local_action:
|
|
||||||
module: wait_for
|
|
||||||
port: "{{ ansible_ssh_port | default('22') }}"
|
|
||||||
host: "{{ ansible_ssh_host | default(inventory_hostname) }}"
|
|
||||||
search_regex: OpenSSH
|
|
||||||
delay: 1
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
---
|
|
||||||
# Copyright 2016, 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: Perform basic LXC host setup
|
|
||||||
hosts: localhost
|
|
||||||
pre_tasks:
|
|
||||||
- name: Ensure apt cache is always refreshed
|
|
||||||
apt:
|
|
||||||
update_cache: yes
|
|
||||||
when:
|
|
||||||
- ansible_pkg_mgr == 'apt'
|
|
||||||
- name: Ensure root's new public ssh key is in authorized_keys
|
|
||||||
authorized_key:
|
|
||||||
user: root
|
|
||||||
key: "{{ hostvars['localhost']['lxc_container_ssh_key'] }}"
|
|
||||||
manage_dir: no
|
|
||||||
- set_fact:
|
|
||||||
lxc_container_ssh_key: "{{ hostvars['localhost']['lxc_container_ssh_key'] }}"
|
|
||||||
- name: Check if this is an OpenStack-CI nodepool instance
|
|
||||||
stat:
|
|
||||||
path: /etc/nodepool/provider
|
|
||||||
register: nodepool
|
|
||||||
- name: Set the files to copy into the container cache for OpenStack-CI instances
|
|
||||||
set_fact:
|
|
||||||
lxc_container_cache_files:
|
|
||||||
- { src: '/etc/pip.conf', dest: '/etc/pip.conf' }
|
|
||||||
when:
|
|
||||||
- nodepool.stat.exists | bool
|
|
||||||
roles:
|
|
||||||
- role: "lxc_hosts"
|
|
||||||
lxc_net_address: 10.100.100.1
|
|
||||||
lxc_net_dhcp_range: 10.100.100.2,10.100.100.100
|
|
||||||
lxc_net_bridge: lxcbr0
|
|
||||||
lxc_kernel_options:
|
|
||||||
- { key: 'fs.inotify.max_user_instances', value: 1024 }
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
---
|
|
||||||
# Copyright 2016, 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: we use become_user because setting become: no or become: false
|
|
||||||
# doesn't seem to override the ansible_become=true in the
|
|
||||||
# inventory
|
|
||||||
- name: Create ssh key pairs for use with containers
|
|
||||||
hosts: localhost
|
|
||||||
become_user: "{{ ansible_ssh_user }}"
|
|
||||||
tasks:
|
|
||||||
- name: Create ssh key pair for root
|
|
||||||
user:
|
|
||||||
name: "{{ ansible_ssh_user }}"
|
|
||||||
generate_ssh_key: "yes"
|
|
||||||
ssh_key_bits: 2048
|
|
||||||
ssh_key_file: ".ssh/id_rsa"
|
|
||||||
- name: get the calling users key
|
|
||||||
command: cat ~/.ssh/id_rsa.pub
|
|
||||||
register: key_get
|
|
||||||
- set_fact:
|
|
||||||
lxc_container_ssh_key: "{{ key_get.stdout }}"
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
galera_cluster_members: "{{ groups['galera_test_hosts'] }}"
|
|
||||||
galera_root_password: secrete
|
|
||||||
galera_root_user: root
|
|
||||||
galera_innodb_buffer_pool_size: 512M
|
|
||||||
galera_innodb_log_buffer_size: 32M
|
|
||||||
galera_server_id: "{{ inventory_hostname | string_2_int }}"
|
|
||||||
galera_wsrep_node_name: "{{ inventory_hostname }}"
|
|
||||||
galera_wsrep_provider_options:
|
|
||||||
- { option: "gcache.size", value: "32M" }
|
|
||||||
galera_server_id: "{{ inventory_hostname | string_2_int }}"
|
|
||||||
@@ -13,19 +13,14 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# Prepare the user ssh keys
|
# Setup the host
|
||||||
- include: test-prepare-keys.yml
|
- include: playbooks/test-setup-host.yml
|
||||||
|
|
||||||
# Prepare the host
|
# Prepare the containers
|
||||||
- include: test-prepare-host.yml
|
- include: playbooks/test-prepare-containers.yml
|
||||||
|
|
||||||
# Run container clean up and build
|
|
||||||
- include: test-prepare-containers.yml
|
|
||||||
|
|
||||||
# Install Galera server
|
# Install Galera server
|
||||||
- include: test-install-galera-server.yml
|
- include: playbooks/test-install-galera.yml
|
||||||
vars:
|
|
||||||
message: "===== Running Current MariaDB Deployment ====="
|
|
||||||
|
|
||||||
# Run functional tests
|
# Run functional tests
|
||||||
- include: test-galera-server-functional.yml
|
- include: test-galera-server-functional.yml
|
||||||
|
|||||||
7
tox.ini
7
tox.ini
@@ -94,7 +94,7 @@ commands =
|
|||||||
[testenv:ansible]
|
[testenv:ansible]
|
||||||
deps =
|
deps =
|
||||||
{[testenv]deps}
|
{[testenv]deps}
|
||||||
ansible==1.9.4
|
ansible==2.1.1
|
||||||
ansible-lint>=2.7.0,<3.0.0
|
ansible-lint>=2.7.0,<3.0.0
|
||||||
setenv =
|
setenv =
|
||||||
{[testenv]setenv}
|
{[testenv]setenv}
|
||||||
@@ -121,6 +121,11 @@ commands =
|
|||||||
ansible-galaxy install \
|
ansible-galaxy install \
|
||||||
--role-file={toxinidir}/tests/ansible-role-requirements.yml \
|
--role-file={toxinidir}/tests/ansible-role-requirements.yml \
|
||||||
--force
|
--force
|
||||||
|
rm -rf {homedir}/.ansible/roles/galera_server
|
||||||
|
bash -c "ln -s {toxinidir} {homedir}/.ansible/roles/galera_server"
|
||||||
|
rm -rf {toxinidir}/tests/playbooks
|
||||||
|
git clone https://git.openstack.org/openstack/openstack-ansible-tests \
|
||||||
|
{toxinidir}/tests/playbooks
|
||||||
|
|
||||||
|
|
||||||
[testenv:ansible-syntax]
|
[testenv:ansible-syntax]
|
||||||
|
|||||||
Reference in New Issue
Block a user