Simplify test inventory

The previous inventory was 'dynamic' in that the host/group
information was added through a playbook. This then required
the playbook implementing the inventory to be executed if
the deployer wished to test any single playbook.

This implements a static inventory and group_vars to achieve
the same result, simplifying the test implementation and
providing greater flexibility when executing the test playbooks.

Change-Id: Ia5b35efd42955cc840990e798eee96a79926b134
This commit is contained in:
Jesse Pretorius
2016-03-22 12:11:34 +00:00
parent 89adad1b90
commit f4893b621f
8 changed files with 88 additions and 74 deletions

View File

@@ -0,0 +1,27 @@
---
# 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.
ansible_ssh_host: "{{ ansible_host }}"
container_name: "{{ inventory_hostname }}"
container_networks:
management_address:
address: "{{ ansible_host }}"
bridge: "lxcbr0"
interface: "eth1"
netmask: "255.255.252.0"
type: "veth"
physical_host: localhost
properties:
service_name: "{{ inventory_hostname }}"

View File

@@ -0,0 +1,17 @@
---
# 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.
properties:
service_name: designate

View File

@@ -1,2 +1,46 @@
[all]
localhost ansible_connection=local ansible_become=True
infra1 ansible_host=10.100.100.101 ansible_become=True
openstack1 ansible_host=10.100.100.102 ansible_become=True
[hosts]
localhost
[all_containers]
infra1
openstack1
[designate_all:children]
designate_api
designate_central
designate_mdns
designate_pool_manager
designate_sink
[designate_api]
openstack1
[designate_central]
openstack1
[designate_mdns]
openstack1
[designate_pool_manager]
openstack1
[designate_sink]
openstack1
[keystone_all]
openstack1
[service_all:children]
rabbitmq_all
galera_all
[rabbitmq_all]
infra1
[galera_all]
infra1

View File

@@ -1,46 +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.
# Inventory is being pre-loaded using a post tasks instead of through a dynamic
# inventory system. While this is not a usual method for deployment it's being
# done for functional testing.
- name: Create container hosts
add_host:
groups: "{{ item.groups }}"
hostname: "{{ item.name }}"
inventory_hostname: "{{ item.name }}"
ansible_ssh_host: "{{ item.address }}"
ansible_become: true
properties:
service_name: "{{ item.service }}"
container_networks:
management_address:
address: "{{ item.address }}"
bridge: "lxcbr0"
interface: "eth1"
netmask: "255.255.252.0"
type: "veth"
physical_host: localhost
container_name: "{{ item.name }}"
with_items:
- name: "infra1"
service: "infra1"
address: "10.100.100.101"
groups: "all,all_containers,rabbitmq_all,galera_all,service_all"
- name: "openstack1"
service: "openstack1"
address: "10.100.100.102"
groups: "all,all_containers,keystone_all,designate_all,designate_api,designate_central,designate_pool_manager,designate_mdns,designate_sink"

View File

@@ -13,13 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Prepare the inventory
hosts: localhost
connection: local
become: yes
tasks:
- include: test-include-inventory.yml
- name: Playbook for deploying designate
hosts: designate_all
user: root

View File

@@ -13,13 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Prepare the inventory
hosts: localhost
connection: local
become: yes
tasks:
- include: test-include-inventory.yml
- name: Playbook for deploying infra services
hosts: service_all
user: root

View File

@@ -13,13 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Prepare the inventory
hosts: localhost
connection: local
become: yes
tasks:
- include: test-include-inventory.yml
- name: Playbook for deploying keystone
hosts: keystone_all
user: root

View File

@@ -13,13 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Prepare the inventory
hosts: localhost
connection: local
become: yes
tasks:
- include: test-include-inventory.yml
- name: Playbook for creating containers
hosts: all_containers
connection: local