Ansible 2.1.1 role testing
Change-Id: I8338e497b9779b137d960f486886c89b0fc7f0e0
This commit is contained in:
parent
58670ced78
commit
8926a4008f
|
@ -29,6 +29,7 @@ doc/build/
|
||||||
*.log
|
*.log
|
||||||
*.sql
|
*.sql
|
||||||
*.sqlite
|
*.sqlite
|
||||||
|
logs/
|
||||||
|
|
||||||
# OS generated files #
|
# OS generated files #
|
||||||
######################
|
######################
|
||||||
|
@ -61,6 +62,8 @@ releasenotes/build
|
||||||
|
|
||||||
# Test temp files
|
# Test temp files
|
||||||
tests/plugins
|
tests/plugins
|
||||||
|
tests/playbooks
|
||||||
|
tests/test.retry
|
||||||
|
|
||||||
# Vagrant testing artifacts
|
# Vagrant testing artifacts
|
||||||
.vagrant
|
.vagrant
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
# Copyright 2016, Comcast Corporation
|
# Copyright 2016, Rackspace US, Inc.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
@ -13,18 +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: Create ssh key pairs for use with containers
|
bridges:
|
||||||
hosts: localhost
|
- "br-mgmt"
|
||||||
become_user: "{{ ansible_ssh_user }}"
|
|
||||||
pre_tasks:
|
ansible_python_interpreter: "/usr/bin/python2"
|
||||||
- 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 user's key
|
|
||||||
command: cat ~/.ssh/id_rsa.pub
|
|
||||||
register: key_get
|
|
||||||
- set_fact:
|
|
||||||
lxc_container_ssh_key: "{{ key_get.stdout }}"
|
|
|
@ -1,5 +1,5 @@
|
||||||
[all]
|
[all]
|
||||||
localhost ansible_connection=local ansible_become=True
|
localhost ansible_become=True
|
||||||
infra1 ansible_host=10.100.100.2 ansible_become=True
|
infra1 ansible_host=10.100.100.2 ansible_become=True
|
||||||
openstack1 ansible_host=10.100.100.3 ansible_become=True
|
openstack1 ansible_host=10.100.100.3 ansible_become=True
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ infra1
|
||||||
[service_all:children]
|
[service_all:children]
|
||||||
rabbitmq_all
|
rabbitmq_all
|
||||||
galera_all
|
galera_all
|
||||||
|
memcached_all
|
||||||
|
|
||||||
[rabbitmq_all]
|
[rabbitmq_all]
|
||||||
infra1
|
infra1
|
||||||
|
@ -23,5 +24,8 @@ infra1
|
||||||
[galera_all]
|
[galera_all]
|
||||||
infra1
|
infra1
|
||||||
|
|
||||||
|
[memcached_all]
|
||||||
|
infra1
|
||||||
|
|
||||||
[zaqar_all]
|
[zaqar_all]
|
||||||
openstack1
|
openstack1
|
|
@ -1,32 +0,0 @@
|
||||||
---
|
|
||||||
# Copyright 2016, Comcast Corporation
|
|
||||||
#
|
|
||||||
# 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: Deploy infra services
|
|
||||||
hosts: galera_all
|
|
||||||
user: root
|
|
||||||
gather_facts: true
|
|
||||||
roles:
|
|
||||||
- role: "rabbitmq_server"
|
|
||||||
rabbitmq_cookie_token: secrete
|
|
||||||
- role: "galera_server"
|
|
||||||
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 }}"
|
|
|
@ -1,81 +0,0 @@
|
||||||
---
|
|
||||||
# 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: Deploy keystone
|
|
||||||
hosts: keystone_all
|
|
||||||
user: root
|
|
||||||
gather_facts: true
|
|
||||||
pre_tasks:
|
|
||||||
- name: Ensure rabbitmq vhost
|
|
||||||
rabbitmq_vhost:
|
|
||||||
name: "{{ keystone_rabbitmq_vhost }}"
|
|
||||||
state: "present"
|
|
||||||
delegate_to: "10.100.100.2"
|
|
||||||
when: inventory_hostname == groups['keystone_all'][0]
|
|
||||||
- name: Ensure rabbitmq user
|
|
||||||
rabbitmq_user:
|
|
||||||
user: "{{ keystone_rabbitmq_userid }}"
|
|
||||||
password: "{{ keystone_rabbitmq_password }}"
|
|
||||||
vhost: "{{ keystone_rabbitmq_vhost }}"
|
|
||||||
configure_priv: ".*"
|
|
||||||
read_priv: ".*"
|
|
||||||
write_priv: ".*"
|
|
||||||
state: "present"
|
|
||||||
delegate_to: "10.100.100.2"
|
|
||||||
when: inventory_hostname == groups['keystone_all'][0]
|
|
||||||
- name: Create DB for service
|
|
||||||
mysql_db:
|
|
||||||
login_user: "root"
|
|
||||||
login_password: "secrete"
|
|
||||||
login_host: "localhost"
|
|
||||||
name: "{{ keystone_galera_database }}"
|
|
||||||
state: "present"
|
|
||||||
delegate_to: "10.100.100.2"
|
|
||||||
when: inventory_hostname == groups['keystone_all'][0]
|
|
||||||
- name: Grant access to the DB for the service
|
|
||||||
mysql_user:
|
|
||||||
login_user: "root"
|
|
||||||
login_password: "secrete"
|
|
||||||
login_host: "localhost"
|
|
||||||
name: "{{ keystone_galera_database }}"
|
|
||||||
password: "{{ keystone_container_mysql_password }}"
|
|
||||||
host: "{{ item }}"
|
|
||||||
state: "present"
|
|
||||||
priv: "{{ keystone_galera_database }}.*:ALL"
|
|
||||||
with_items:
|
|
||||||
- "localhost"
|
|
||||||
- "%"
|
|
||||||
delegate_to: "10.100.100.2"
|
|
||||||
when: inventory_hostname == groups['keystone_all'][0]
|
|
||||||
roles:
|
|
||||||
- role: os_keystone
|
|
||||||
vars:
|
|
||||||
external_lb_vip_address: 10.100.100.2
|
|
||||||
internal_lb_vip_address: 10.100.100.2
|
|
||||||
keystone_galera_address: 10.100.100.2
|
|
||||||
keystone_galera_database: keystone
|
|
||||||
keystone_venv_tag: testing
|
|
||||||
keystone_developer_mode: true
|
|
||||||
keystone_auth_admin_token: SuperSecreteTestToken
|
|
||||||
keystone_auth_admin_password: SuperSecretePassword
|
|
||||||
keystone_service_password: secrete
|
|
||||||
keystone_rabbitmq_password: secrete
|
|
||||||
keystone_container_mysql_password: SuperSecrete
|
|
||||||
keystone_rabbitmq_port: 5671
|
|
||||||
keystone_rabbitmq_userid: keystone
|
|
||||||
keystone_rabbitmq_vhost: /keystone
|
|
||||||
keystone_rabbitmq_servers: 10.100.100.2
|
|
||||||
keystone_rabbitmq_use_ssl: false
|
|
||||||
galera_client_drop_config_file: false
|
|
|
@ -21,15 +21,5 @@
|
||||||
zaqar_developer_mode: true
|
zaqar_developer_mode: true
|
||||||
zaqar_install_apache: true
|
zaqar_install_apache: true
|
||||||
zaqar_mgmt_db_connection_string: 'sqlite:////tmp/zaqar.db'
|
zaqar_mgmt_db_connection_string: 'sqlite:////tmp/zaqar.db'
|
||||||
external_lb_vip_address: 10.100.100.2
|
vars_files:
|
||||||
internal_lb_vip_address: 10.100.100.2
|
- playbooks/test-vars.yml
|
||||||
keystone_admin_user_name: admin
|
|
||||||
keystone_admin_tenant_name: admin
|
|
||||||
keystone_auth_admin_password: SuperSecretePassword
|
|
||||||
keystone_service_adminuri_insecure: false
|
|
||||||
keystone_service_internaluri_insecure: false
|
|
||||||
keystone_service_internaluri: "http://{{ internal_lb_vip_address }}:5000"
|
|
||||||
keystone_service_internalurl: "{{ keystone_service_internaluri }}/v3"
|
|
||||||
keystone_service_adminuri: "http://{{ internal_lb_vip_address }}:35357"
|
|
||||||
keystone_service_adminurl: "{{ keystone_service_adminuri }}/v3"
|
|
||||||
keystone_service_region: RegionOne
|
|
|
@ -1,33 +0,0 @@
|
||||||
---
|
|
||||||
# Copyright 2016, Comcast Corporation
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
connection: local
|
|
||||||
gather_facts: false
|
|
||||||
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,42 +0,0 @@
|
||||||
---
|
|
||||||
# Copyright 2016, Comcast Corporation
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
become: yes
|
|
||||||
pre_tasks:
|
|
||||||
- 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.8,10.100.100.253
|
|
||||||
lxc_net_bridge: lxcbr0
|
|
||||||
lxc_kernel_options:
|
|
||||||
- { key: 'fs.inotify.max_user_instances', value: 1024 }
|
|
|
@ -25,3 +25,5 @@
|
||||||
uri:
|
uri:
|
||||||
url: "http://localhost:8888"
|
url: "http://localhost:8888"
|
||||||
status_code: 401
|
status_code: 401
|
||||||
|
vars_files:
|
||||||
|
- playbooks/test-vars.yml
|
||||||
|
|
|
@ -13,20 +13,17 @@
|
||||||
# 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
|
|
||||||
- include: test-prepare-host.yml
|
|
||||||
|
|
||||||
# Prepare the containers
|
# Prepare the containers
|
||||||
- include: test-prepare-containers.yml
|
- include: playbooks/test-prepare-containers.yml
|
||||||
|
|
||||||
# Install RabbitMQ/MariaDB
|
# Install RabbitMQ/MariaDB
|
||||||
- include: test-install-infra.yml
|
- include: playbooks/test-install-infra.yml
|
||||||
|
|
||||||
# Install Keystone
|
# Install Keystone
|
||||||
- include: test-install-keystone.yml
|
- include: playbooks/test-install-keystone.yml
|
||||||
|
|
||||||
# Install Zaqar
|
# Install Zaqar
|
||||||
- include: test-install-zaqar.yml
|
- include: test-install-zaqar.yml
|
||||||
|
|
6
tox.ini
6
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,7 +121,9 @@ 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 {toxinidir}/tests/playbooks
|
||||||
|
git clone https://git.openstack.org/openstack/openstack-ansible-tests \
|
||||||
|
{toxinidir}/tests/playbooks
|
||||||
|
|
||||||
[testenv:ansible-syntax]
|
[testenv:ansible-syntax]
|
||||||
deps =
|
deps =
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
cache_timeout: 600
|
cache_timeout: 600
|
||||||
|
|
||||||
zaqar_distro_packages:
|
zaqar_distro_packages:
|
||||||
|
- "{% if zaqar_developer_mode %}git{% endif %}"
|
||||||
- gcc
|
- gcc
|
||||||
- libxml2-dev
|
- libxml2-dev
|
||||||
- libxslt1-dev
|
- libxslt1-dev
|
||||||
|
@ -26,3 +27,4 @@ zaqar_distro_packages:
|
||||||
- "{% if zaqar_install_apache %}apache2{% endif %}"
|
- "{% if zaqar_install_apache %}apache2{% endif %}"
|
||||||
- "{% if zaqar_install_apache %}libapache2-mod-wsgi{% endif %}"
|
- "{% if zaqar_install_apache %}libapache2-mod-wsgi{% endif %}"
|
||||||
- "{% if zaqar_install_nginx %}nginx{% endif %}"
|
- "{% if zaqar_install_nginx %}nginx{% endif %}"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue