From 2257044bc06129a97772669762b5afb518210d6d Mon Sep 17 00:00:00 2001 From: Andy McCrae Date: Fri, 16 Sep 2016 13:55:44 +0100 Subject: [PATCH] Use openstack-ansible-tests repository for Swift Move to use the openstack-ansible-tests repository for Swift. Make changes use Ansible 2.1.1 (These are required for gating to work properly, since the majority of repositories have already changed). Additionally, lets set this up to work with 1 infra host in the MR swift gate to improve efficiency. Change-Id: Ic0d35bcf8bafb90a986c7cdda3987f70580af165 --- .gitignore | 5 +- manual-test.rc | 33 +++++ run_tests.sh | 10 +- tasks/swift_rings_distribute.yml | 4 +- templates/ring.contents.j2 | 10 +- tests/ansible-role-requirements.yml | 8 ++ tests/host_vars/infra1.yml | 3 +- tests/host_vars/{infraA1.yml => infraMR.yml} | 3 +- .../host_vars/{infraB1.yml => localhost.yml} | 11 +- tests/host_vars/swift-proxy.yml | 3 +- tests/host_vars/swift-proxyA.yml | 6 +- tests/host_vars/swift-proxyB.yml | 6 +- tests/host_vars/swift-storage1.yml | 3 +- tests/host_vars/swift-storage2.yml | 3 +- tests/host_vars/swift-storage3.yml | 3 +- tests/host_vars/swift-storage4.yml | 3 +- tests/host_vars/swift-storageA1.yml | 6 +- tests/host_vars/swift-storageA2.yml | 6 +- tests/host_vars/swift-storageB1.yml | 6 +- tests/host_vars/swift-storageB2.yml | 6 +- tests/inventory | 6 +- tests/inventory_MR_A | 19 ++- tests/inventory_MR_B | 16 ++- ...ontainers.yml => swift-overrides-MR-A.yml} | 32 ++--- ...all-infra.yml => swift-overrides-MR-B.yml} | 8 +- tests/swift-overrides.yml | 22 ++++ tests/swift_test.conf.j2 | 2 +- tests/test-install-keystone.yml | 50 ------- tests/test-install-swift.yml | 30 ----- tests/test-prepare-host.yml | 70 ---------- tests/test-prepare-keys.yml | 33 ----- tests/test-setup-swifthosts.yml | 90 ------------- tests/test-swift-MR-interfaces.cfg.j2 | 67 ---------- tests/test-swift-functional.yml | 7 +- tests/test-swift-interfaces.cfg.j2 | 36 ----- tests/test-vars-MR-A.yml | 124 ------------------ tests/test-vars-MR-B.yml | 124 ------------------ tests/test-vars.yml | 108 --------------- tests/test.yml | 21 +-- tox.ini | 60 ++++----- 40 files changed, 195 insertions(+), 868 deletions(-) create mode 100644 manual-test.rc rename tests/host_vars/{infraA1.yml => infraMR.yml} (91%) rename tests/host_vars/{infraB1.yml => localhost.yml} (72%) rename tests/{test-prepare-containers.yml => swift-overrides-MR-A.yml} (51%) rename tests/{test-install-infra.yml => swift-overrides-MR-B.yml} (77%) create mode 100644 tests/swift-overrides.yml delete mode 100644 tests/test-install-keystone.yml delete mode 100644 tests/test-install-swift.yml delete mode 100644 tests/test-prepare-host.yml delete mode 100644 tests/test-prepare-keys.yml delete mode 100644 tests/test-setup-swifthosts.yml delete mode 100644 tests/test-swift-MR-interfaces.cfg.j2 delete mode 100644 tests/test-swift-interfaces.cfg.j2 delete mode 100644 tests/test-vars-MR-A.yml delete mode 100644 tests/test-vars-MR-B.yml delete mode 100644 tests/test-vars.yml diff --git a/.gitignore b/.gitignore index ca2ac14c..53a7668e 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ doc/build/ *.log *.sql *.sqlite +logs/* # OS generated files # ###################### @@ -61,6 +62,8 @@ releasenotes/build # Test temp files tests/plugins +tests/playbooks +tests/test.retry -# Vagrant testing artifacts +# Vagrant artifacts .vagrant diff --git a/manual-test.rc b/manual-test.rc new file mode 100644 index 00000000..f7e77710 --- /dev/null +++ b/manual-test.rc @@ -0,0 +1,33 @@ +export VIRTUAL_ENV=$(pwd) +export ANSIBLE_HOST_KEY_CHECKING=False +export ANSIBLE_SSH_CONTROL_PATH=/tmp/%%h-%%r + +# TODO (odyssey4me) These are only here as they are non-standard folder +# names for Ansible 1.9.x. We are using the standard folder names for +# Ansible v2.x. We can remove this when we move to Ansible 2.x. +export ANSIBLE_ACTION_PLUGINS=${HOME}/.ansible/plugins/action +export ANSIBLE_CALLBACK_PLUGINS=${HOME}/.ansible/plugins/callback +export ANSIBLE_FILTER_PLUGINS=${HOME}/.ansible/plugins/filter +export ANSIBLE_LOOKUP_PLUGINS=${HOME}/.ansible/plugins/lookup + +# This is required as the default is the current path or a path specified +# in ansible.cfg +export ANSIBLE_LIBRARY=${HOME}/.ansible/plugins/library + +# This is required as the default is '/etc/ansible/roles' or a path +# specified in ansible.cfg +export ANSIBLE_ROLES_PATH=${HOME}/.ansible/roles:$(pwd)/.. + +export ANSIBLE_SSH_ARGS="-o ControlMaster=no \ + -o UserKnownHostsFile=/dev/null \ + -o StrictHostKeyChecking=no \ + -o ServerAliveInterval=64 \ + -o ServerAliveCountMax=1024 \ + -o Compression=no \ + -o TCPKeepAlive=yes \ + -o VerifyHostKeyDNS=no \ + -o ForwardX11=no \ + -o ForwardAgent=yes" + +echo "Run manual functional tests by executing the following:" +echo "# ./.tox/functional/bin/ansible-playbook -i tests/inventory tests/test.yml -e \"rolename=$(pwd)\"" diff --git a/run_tests.sh b/run_tests.sh index 0a49aa3e..482a3894 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -24,23 +24,23 @@ if [ ! "$(which pip)" ]; then fi # Install bindep and tox -pip install bindep tox +sudo pip install bindep tox # CentOS 7 requires two additional packages: # redhat-lsb-core - for bindep profile support # epel-release - required to install python-ndg_httpsclient/python2-pyasn1 if [ "$(which yum)" ]; then - yum -y install redhat-lsb-core epel-release + sudo yum -y install redhat-lsb-core epel-release fi # Install OS packages using bindep if apt-get -v >/dev/null 2>&1 ; then - apt-get update + sudo apt-get update DEBIAN_FRONTEND=noninteractive \ - apt-get -q --option "Dpkg::Options::=--force-confold" \ + sudo apt-get -q --option "Dpkg::Options::=--force-confold" \ --assume-yes install `bindep -b -f bindep.txt test` else - yum install -y `bindep -b -f bindep.txt test` + sudo yum install -y `bindep -b -f bindep.txt test` fi # run through each tox env and execute the test diff --git a/tasks/swift_rings_distribute.yml b/tasks/swift_rings_distribute.yml index deadc3ba..55a61111 100644 --- a/tasks/swift_rings_distribute.yml +++ b/tasks/swift_rings_distribute.yml @@ -20,7 +20,7 @@ - name: "Get swift rings" command: | rsync -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' \ - -avz {{ swift_system_user_name }}@{{ hostvars[groups['swift_hosts'][0]]['ansible_ssh_host'] }}:/etc/swift/ring_build_files/ \ + -avz {{ swift_system_user_name }}@{{ hostvars[groups['swift_hosts'][0]]['ansible_host'] }}:/etc/swift/ring_build_files/ \ /etc/swift/ become: yes become_user: "{{ swift_system_user_name }}" @@ -28,7 +28,7 @@ - name: "Get swift rings for backup in ring_build_files directory" command: | rsync -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' \ - -avz {{ swift_system_user_name }}@{{ hostvars[groups['swift_hosts'][0]]['ansible_ssh_host'] }}:/etc/swift/ring_build_files/ \ + -avz {{ swift_system_user_name }}@{{ hostvars[groups['swift_hosts'][0]]['ansible_host'] }}:/etc/swift/ring_build_files/ \ /etc/swift/ring_build_files/ become: yes become_user: "{{ swift_system_user_name }}" diff --git a/templates/ring.contents.j2 b/templates/ring.contents.j2 index 03f4a995..0b9d9a58 100644 --- a/templates/ring.contents.j2 +++ b/templates/ring.contents.j2 @@ -47,10 +47,10 @@ {### Loop through the swift_hosts #} {% for host in groups['swift_hosts'] %} {### Set the default storage_ip #} -{% set def_storage_ip = hostvars[host]['ansible_ssh_host'] %} +{% set def_storage_ip = hostvars[host]['ansible_host'] %} {% if swift.storage_network is defined %} {% set storage_bridge = 'ansible_' + swift.storage_network|replace('-', '_') %} -{% set def_storage_ip = hostvars[host][storage_bridge]['ipv4']['address'] | default(hostvars[host]['ansible_ssh_host']) %} +{% set def_storage_ip = hostvars[host][storage_bridge]['ipv4']['address'] | default(hostvars[host]['ansible_host']) %} {% endif %} {### Set the default replication_ip #} {% set def_repl_ip = def_storage_ip %} @@ -84,9 +84,9 @@ {% set storage_port = drive.storage_port | default(swift_vars.storage_port | default(port)) %} {### Update the device with the appropriate values #} {% set _update = device.update({'device':drive.name}) %} -{% set _update = device.update({'weight': weight}) %} -{% set _update = device.update({'region': region}) %} -{% set _update = device.update({'zone': zone}) %} +{% set _update = device.update({'weight': weight|int}) %} +{% set _update = device.update({'region': region|int}) %} +{% set _update = device.update({'zone': zone|int}) %} {% set _update = device.update({'replication_ip': repl_ip}) %} {% set _update = device.update({'replication_port': repl_port|int}) %} {% set _update = device.update({'ip': storage_ip}) %} diff --git a/tests/ansible-role-requirements.yml b/tests/ansible-role-requirements.yml index 6abc24ca..fe68d49d 100644 --- a/tests/ansible-role-requirements.yml +++ b/tests/ansible-role-requirements.yml @@ -30,6 +30,14 @@ src: https://git.openstack.org/openstack/openstack-ansible-galera_server scm: git version: master +- name: rabbitmq_server + src: https://git.openstack.org/openstack/openstack-ansible-rabbitmq_server + scm: git + version: master +- name: openstack_hosts + src: https://git.openstack.org/openstack/openstack-ansible-openstack_hosts + scm: git + version: master - name: os_keystone src: https://git.openstack.org/openstack/openstack-ansible-os_keystone scm: git diff --git a/tests/host_vars/infra1.yml b/tests/host_vars/infra1.yml index cb00fb61..0231b64e 100644 --- a/tests/host_vars/infra1.yml +++ b/tests/host_vars/infra1.yml @@ -13,11 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -ansible_ssh_host: 10.1.1.101 ansible_host: 10.1.1.101 container_networks: management_address: - address: "{{ ansible_ssh_host }}" + address: "{{ ansible_host }}" bridge: "br-mgmt" interface: "eth1" netmask: "255.255.255.0" diff --git a/tests/host_vars/infraA1.yml b/tests/host_vars/infraMR.yml similarity index 91% rename from tests/host_vars/infraA1.yml rename to tests/host_vars/infraMR.yml index e561a125..0b179518 100644 --- a/tests/host_vars/infraA1.yml +++ b/tests/host_vars/infraMR.yml @@ -13,11 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -ansible_ssh_host: 10.1.1.101 ansible_host: 10.1.1.101 container_networks: management_address: - address: "{{ ansible_ssh_host }}" + address: "{{ ansible_host }}" bridge: "br-mgmtA" interface: "eth1" netmask: "255.255.255.0" diff --git a/tests/host_vars/infraB1.yml b/tests/host_vars/localhost.yml similarity index 72% rename from tests/host_vars/infraB1.yml rename to tests/host_vars/localhost.yml index b6c91038..24b23dda 100644 --- a/tests/host_vars/infraB1.yml +++ b/tests/host_vars/localhost.yml @@ -13,12 +13,5 @@ # See the License for the specific language governing permissions and # limitations under the License. -ansible_ssh_host: 10.1.11.101 -ansible_host: 10.1.11.101 -container_networks: - management_address: - address: "{{ ansible_ssh_host }}" - bridge: "br-mgmtB" - interface: "eth1" - netmask: "255.255.255.0" - type: "veth" +ansible_python_interpreter: "/usr/bin/python2" +ansible_become: True diff --git a/tests/host_vars/swift-proxy.yml b/tests/host_vars/swift-proxy.yml index c714d2e7..886ed33e 100644 --- a/tests/host_vars/swift-proxy.yml +++ b/tests/host_vars/swift-proxy.yml @@ -13,12 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -ansible_ssh_host: 10.1.1.102 ansible_host: 10.1.1.102 storage_address: 10.1.2.102 container_networks: management_address: - address: "{{ ansible_ssh_host }}" + address: "{{ ansible_host }}" bridge: "br-mgmt" interface: "eth1" netmask: "255.255.255.0" diff --git a/tests/host_vars/swift-proxyA.yml b/tests/host_vars/swift-proxyA.yml index c38a51ae..8240af4e 100644 --- a/tests/host_vars/swift-proxyA.yml +++ b/tests/host_vars/swift-proxyA.yml @@ -13,16 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -ansible_ssh_host: 10.1.1.102 ansible_host: 10.1.1.102 storage_address: 10.1.2.102 container_networks: management_address: - address: "{{ ansible_ssh_host }}" + address: "{{ ansible_host }}" bridge: "br-mgmtA" interface: "eth1" netmask: "255.255.255.0" type: "veth" + static_routes: + - cidr: "10.1.11.0/24" + gateway: "10.1.1.1" storage_address: address: "{{ storage_address }}" bridge: "br-storageA" diff --git a/tests/host_vars/swift-proxyB.yml b/tests/host_vars/swift-proxyB.yml index fb09c516..a29bccbe 100644 --- a/tests/host_vars/swift-proxyB.yml +++ b/tests/host_vars/swift-proxyB.yml @@ -13,16 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -ansible_ssh_host: 10.1.11.102 ansible_host: 10.1.11.102 storage_address: 10.1.12.102 container_networks: management_address: - address: "{{ ansible_ssh_host }}" + address: "{{ ansible_host }}" bridge: "br-mgmtB" interface: "eth1" netmask: "255.255.255.0" type: "veth" + static_routes: + - cidr: "10.1.1.0/24" + gateway: "10.1.11.1" storage_address: address: "{{ storage_address }}" bridge: "br-storageB" diff --git a/tests/host_vars/swift-storage1.yml b/tests/host_vars/swift-storage1.yml index 41de976d..6a0551df 100644 --- a/tests/host_vars/swift-storage1.yml +++ b/tests/host_vars/swift-storage1.yml @@ -13,13 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -ansible_ssh_host: 10.1.1.103 ansible_host: 10.1.1.103 storage_address: 10.1.2.103 replication_address: 10.1.3.103 container_networks: management_address: - address: "{{ ansible_ssh_host }}" + address: "{{ ansible_host }}" bridge: "br-mgmt" interface: "eth1" netmask: "255.255.255.0" diff --git a/tests/host_vars/swift-storage2.yml b/tests/host_vars/swift-storage2.yml index f1adc381..e692fd67 100644 --- a/tests/host_vars/swift-storage2.yml +++ b/tests/host_vars/swift-storage2.yml @@ -13,13 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -ansible_ssh_host: 10.1.1.104 ansible_host: 10.1.1.104 storage_address: 10.1.2.104 replication_address: 10.1.3.104 container_networks: management_address: - address: "{{ ansible_ssh_host }}" + address: "{{ ansible_host }}" bridge: "br-mgmt" interface: "eth1" netmask: "255.255.255.0" diff --git a/tests/host_vars/swift-storage3.yml b/tests/host_vars/swift-storage3.yml index 2e626c69..fea327e4 100644 --- a/tests/host_vars/swift-storage3.yml +++ b/tests/host_vars/swift-storage3.yml @@ -13,13 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -ansible_ssh_host: 10.1.1.105 ansible_host: 10.1.1.105 storage_address: 10.1.2.105 replication_address: 10.1.3.105 container_networks: management_address: - address: "{{ ansible_ssh_host }}" + address: "{{ ansible_host }}" bridge: "br-mgmt" interface: "eth1" netmask: "255.255.255.0" diff --git a/tests/host_vars/swift-storage4.yml b/tests/host_vars/swift-storage4.yml index 4252f1f1..1384586a 100644 --- a/tests/host_vars/swift-storage4.yml +++ b/tests/host_vars/swift-storage4.yml @@ -13,13 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -ansible_ssh_host: 10.1.1.106 ansible_host: 10.1.1.106 storage_address: 10.1.2.106 replication_address: 10.1.3.106 container_networks: management_address: - address: "{{ ansible_ssh_host }}" + address: "{{ ansible_host }}" bridge: "br-mgmt" interface: "eth1" netmask: "255.255.255.0" diff --git a/tests/host_vars/swift-storageA1.yml b/tests/host_vars/swift-storageA1.yml index 19b31917..bad476aa 100644 --- a/tests/host_vars/swift-storageA1.yml +++ b/tests/host_vars/swift-storageA1.yml @@ -13,17 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -ansible_ssh_host: 10.1.1.103 ansible_host: 10.1.1.103 storage_address: 10.1.2.103 replication_address: 10.1.3.103 container_networks: management_address: - address: "{{ ansible_ssh_host }}" + address: "{{ ansible_host }}" bridge: "br-mgmtA" interface: "eth1" netmask: "255.255.255.0" type: "veth" + static_routes: + - cidr: "10.1.11.0/24" + gateway: "10.1.1.1" storage_address: address: "{{ storage_address }}" bridge: "br-storageA" diff --git a/tests/host_vars/swift-storageA2.yml b/tests/host_vars/swift-storageA2.yml index 1c41dc60..b7eb5a8e 100644 --- a/tests/host_vars/swift-storageA2.yml +++ b/tests/host_vars/swift-storageA2.yml @@ -13,17 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -ansible_ssh_host: 10.1.1.104 ansible_host: 10.1.1.104 storage_address: 10.1.2.104 replication_address: 10.1.3.104 container_networks: management_address: - address: "{{ ansible_ssh_host }}" + address: "{{ ansible_host }}" bridge: "br-mgmtA" interface: "eth1" netmask: "255.255.255.0" type: "veth" + static_routes: + - cidr: "10.1.11.0/24" + gateway: "10.1.1.1" storage_address: address: "{{ storage_address }}" bridge: "br-storageA" diff --git a/tests/host_vars/swift-storageB1.yml b/tests/host_vars/swift-storageB1.yml index cdf8e8ed..b725d5ab 100644 --- a/tests/host_vars/swift-storageB1.yml +++ b/tests/host_vars/swift-storageB1.yml @@ -13,17 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -ansible_ssh_host: 10.1.11.103 ansible_host: 10.1.11.103 storage_address: 10.1.12.103 replication_address: 10.1.13.103 container_networks: management_address: - address: "{{ ansible_ssh_host }}" + address: "{{ ansible_host }}" bridge: "br-mgmtB" interface: "eth1" netmask: "255.255.255.0" type: "veth" + static_routes: + - cidr: "10.1.1.0/24" + gateway: "10.1.11.1" storage_address: address: "{{ storage_address }}" bridge: "br-storageB" diff --git a/tests/host_vars/swift-storageB2.yml b/tests/host_vars/swift-storageB2.yml index 71c37458..e235db67 100644 --- a/tests/host_vars/swift-storageB2.yml +++ b/tests/host_vars/swift-storageB2.yml @@ -13,17 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -ansible_ssh_host: 10.1.11.104 ansible_host: 10.1.11.104 storage_address: 10.1.12.104 replication_address: 10.1.13.104 container_networks: management_address: - address: "{{ ansible_ssh_host }}" + address: "{{ ansible_host }}" bridge: "br-mgmtB" interface: "eth1" netmask: "255.255.255.0" type: "veth" + static_routes: + - cidr: "10.1.1.0/24" + gateway: "10.1.11.1" storage_address: address: "{{ storage_address }}" bridge: "br-storageB" diff --git a/tests/inventory b/tests/inventory index 0016add1..7c89f5c2 100644 --- a/tests/inventory +++ b/tests/inventory @@ -1,5 +1,5 @@ [all] -localhost ansible_connection=local ansible_become=True +localhost infra1 swift-proxy swift-storage1 @@ -21,9 +21,13 @@ infra1 [memcached_all] infra1 +[rabbitmq_all] +infra1 + [service_all:children] galera_all memcached_all +rabbitmq_all [keystone_all] infra1 diff --git a/tests/inventory_MR_A b/tests/inventory_MR_A index 810517ad..e91d421d 100644 --- a/tests/inventory_MR_A +++ b/tests/inventory_MR_A @@ -1,28 +1,35 @@ [all] -localhost ansible_connection=local ansible_become=True -infraA1 +localhost +infraMR swift-proxyA swift-storageA1 swift-storageA2 [all_containers] -infraA1 +infraMR swift-proxyA swift-storageA1 swift-storageA2 +swift-proxyB +swift-storageB1 +swift-storageB2 [galera_all] -infraA1 +infraMR [memcached_all] -infraA1 +infraMR + +[rabbitmq_all] +infraMR [service_all:children] galera_all memcached_all +rabbitmq_all [keystone_all] -infraA1 +infraMR [swift_hosts] swift-storageA1 diff --git a/tests/inventory_MR_B b/tests/inventory_MR_B index d4d656ed..965abe83 100644 --- a/tests/inventory_MR_B +++ b/tests/inventory_MR_B @@ -1,28 +1,32 @@ [all] -localhost ansible_connection=local ansible_become=True -infraB1 +localhost +infraMR swift-proxyB swift-storageB1 swift-storageB2 [all_containers] -infraB1 +infraMR swift-proxyB swift-storageB1 swift-storageB2 [galera_all] -infraB1 +infraMR [memcached_all] -infraB1 +infraMR + +[rabbitmq_all] +infraMR [service_all:children] galera_all memcached_all +rabbitmq_all [keystone_all] -infraB1 +infraMR [swift_hosts] swift-storageB1 diff --git a/tests/test-prepare-containers.yml b/tests/swift-overrides-MR-A.yml similarity index 51% rename from tests/test-prepare-containers.yml rename to tests/swift-overrides-MR-A.yml index f85472e4..39e112bd 100644 --- a/tests/test-prepare-containers.yml +++ b/tests/swift-overrides-MR-A.yml @@ -13,19 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Playbook for creating containers - hosts: all_containers - gather_facts: false - roles: - - role: "lxc_container_create" - 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 +# Only MR-A needs the bridges as it does the host setup +bridges: + - name: "br-mgmtA" + ip_addr: "10.1.1.1" + - name: "br-storageA" + ip_addr: "10.1.2.1" + - name: "br-replA" + ip_addr: "10.1.3.1" + - name: "br-mgmtB" + ip_addr: "10.1.11.1" + - name: "br-storageB" + ip_addr: "10.1.12.1" + - name: "br-replB" + ip_addr: "10.1.13.1" + +test_swift_region: 1 diff --git a/tests/test-install-infra.yml b/tests/swift-overrides-MR-B.yml similarity index 77% rename from tests/test-install-infra.yml rename to tests/swift-overrides-MR-B.yml index 6e3e2136..8fd9a2b3 100644 --- a/tests/test-install-infra.yml +++ b/tests/swift-overrides-MR-B.yml @@ -13,10 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Playbook for deploying infra services - hosts: service_all - user: root - gather_facts: true - roles: - - role: "memcached_server" - - role: "galera_server" +test_swift_region: 2 diff --git a/tests/swift-overrides.yml b/tests/swift-overrides.yml new file mode 100644 index 00000000..70abc8e1 --- /dev/null +++ b/tests/swift-overrides.yml @@ -0,0 +1,22 @@ +--- +# 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. + +bridges: + - name: "br-mgmt" + ip_addr: "10.1.1.1" + - name: "br-storage" + ip_addr: "10.1.2.1" + - name: "br-repl" + ip_addr: "10.1.3.1" diff --git a/tests/swift_test.conf.j2 b/tests/swift_test.conf.j2 index 4ea82719..deb2507c 100644 --- a/tests/swift_test.conf.j2 +++ b/tests/swift_test.conf.j2 @@ -8,7 +8,7 @@ # For keystone v2 change auth_version to 2 and auth_prefix to /v2.0/ # And "allow_account_management" should not be set "true" auth_version = 3 -auth_host = {{ internal_lb_vip_address }} +auth_host = {{ hostvars[groups['keystone_all'][0]]['ansible_host'] }} auth_port = 5000 auth_ssl = no auth_prefix = /v3/ diff --git a/tests/test-install-keystone.yml b/tests/test-install-keystone.yml deleted file mode 100644 index 613d68e8..00000000 --- a/tests/test-install-keystone.yml +++ /dev/null @@ -1,50 +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: Playbook for deploying keystone - hosts: keystone_all - user: root - gather_facts: true - pre_tasks: - - name: Create DB for service - mysql_db: - login_user: "root" - login_password: "secrete" - login_host: "localhost" - name: "{{ keystone_galera_database }}" - state: "present" - delegate_to: "{{ groups['galera_all'][0] }}" - when: inventory_hostname == groups['keystone_all'][0] - tags: - - mysql-db-setup - - name: Grant access to the DB for the service - mysql_user: - login_user: "{{ galera_root_user }}" - login_password: "{{ galera_root_password }}" - 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: "{{ groups['galera_all'][0] }}" - when: inventory_hostname == groups['keystone_all'][0] - tags: - - mysql-db-setup - roles: - - role: os_keystone diff --git a/tests/test-install-swift.yml b/tests/test-install-swift.yml deleted file mode 100644 index ebd2a2cf..00000000 --- a/tests/test-install-swift.yml +++ /dev/null @@ -1,30 +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. - -# We can set the swift_groups so that the multi-region test will run against only the local hosts -# when the remote hosts haven't been created yet. -- name: Playbook for deploying swift - hosts: "{{ swift_groups | default('swift_all:swift_remote_all') }}" - user: root - gather_facts: true - pre_tasks: - - name: Set swift replication address (container) - set_fact: - replication_address: "{{ hostvars[inventory_hostname]['container_networks']['replication_address']['address'] }}" - when: - - inventory_hostname in groups['swift_all'] - - hostvars[inventory_hostname]['container_networks']['replication_address']['address'] is defined - roles: - - role: "{{ rolename | basename }}" diff --git a/tests/test-prepare-host.yml b/tests/test-prepare-host.yml deleted file mode 100644 index c8641e75..00000000 --- a/tests/test-prepare-host.yml +++ /dev/null @@ -1,70 +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: Playbook for configuring the LXC host - hosts: localhost - pre_tasks: - - name: Update apt cache - apt: - update_cache: yes - when: ansible_os_family == 'Debian' - - 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 - post_tasks: - - name: Ensure that /etc/network/interfaces.d/ exists - file: - path: /etc/network/interfaces.d/ - state: directory - - name: Copy network configuration - template: - src: "{{ interfaces_file }}" - dest: /etc/network/interfaces.d/swift_interfaces.cfg - register: swift_interfaces - - - name: Ensure our interfaces.d configuration files are loaded automatically - lineinfile: - dest: /etc/network/interfaces - line: "source /etc/network/interfaces.d/*.cfg" - - - name: Shut down the network interfaces - command: "ifdown {{ item }}" - when: swift_interfaces | changed - with_items: - - "{{ bridges }}" - - - name: Start the network interfaces - command: "ifup {{ item }}" - when: swift_interfaces | changed - with_items: - - "{{ bridges }}" - - - name: Add iptables rule to ensure ssh checksum is correct - command: /sbin/iptables -A POSTROUTING -t mangle -p tcp --dport 22 -j CHECKSUM --checksum-fill - roles: - - role: "lxc_hosts" diff --git a/tests/test-prepare-keys.yml b/tests/test-prepare-keys.yml deleted file mode 100644 index a4fad4f5..00000000 --- a/tests/test-prepare-keys.yml +++ /dev/null @@ -1,33 +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. - -# 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: Playbook for establishing ssh keys - hosts: localhost - become_user: "{{ ansible_ssh_user }}" - pre_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 user's key - command: cat ~/.ssh/id_rsa.pub - register: key_get - - set_fact: - lxc_container_ssh_key: "{{ key_get.stdout }}" diff --git a/tests/test-setup-swifthosts.yml b/tests/test-setup-swifthosts.yml deleted file mode 100644 index 61bdf0f4..00000000 --- a/tests/test-setup-swifthosts.yml +++ /dev/null @@ -1,90 +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: Swift setup - hosts: swift_hosts - user: root - gather_facts: true - pre_tasks: - - name: Ensure xfsprogs is installed on localhost - apt: - name: xfsprogs - state: present - delegate_to: "{{ physical_host }}" - run_once: true - when: - - ansible_pkg_mgr == 'apt' - - name: Ensure xfsprogs is installed on containers - apt: - name: xfsprogs - state: present - when: - - ansible_pkg_mgr == 'apt' - - name: Openstack directory Create - file: - state: directory - path: "/openstack/{{ item }}" - with_items: - - 'swift1' - - 'swift2' - - name: Create sparse Swift files - shell: "truncate -s 1024G /opt/{{container_name}}_{{ item }}.img" - args: - creates: "/opt/{{ container_name}}_{{ item }}.img" - with_items: - - 'swift1' - - 'swift2' - register: swift_create - delegate_to: "{{ physical_host }}" - - name: Format the Swift files - filesystem: - fstype: xfs - dev: "/opt/{{ container_name}}_{{ item }}.img" - when: swift_create | changed - with_items: - - 'swift1' - - 'swift2' - delegate_to: "{{ physical_host }}" - - name: Create the Swift fstab entries and mount the file systems - mount: - name: "/srv/{{ container_name }}_{{ item }}" - src: "/opt/{{ container_name }}_{{ item }}.img" - fstype: xfs - opts: 'loop,noatime,nodiratime,nobarrier,logbufs=8' - passno: 0 - dump: 0 - state: mounted - with_items: - - 'swift1' - - 'swift2' - register: mount_status - until: mount_status | success - retries: 5 - delay: 2 - delegate_to: "{{ physical_host }}" - - name: Swift extra lxc config - lxc_container: - name: "{{ container_name }}" - container_config: - - "lxc.mount.entry=/srv/{{ container_name }}_swift1 openstack/swift1 none bind 0 0" - - "lxc.mount.entry=/srv/{{ container_name }}_swift2 openstack/swift2 none bind 0 0" - delegate_to: "{{ physical_host }}" - - 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 diff --git a/tests/test-swift-MR-interfaces.cfg.j2 b/tests/test-swift-MR-interfaces.cfg.j2 deleted file mode 100644 index 271aed70..00000000 --- a/tests/test-swift-MR-interfaces.cfg.j2 +++ /dev/null @@ -1,67 +0,0 @@ -## The default networking requires several bridges. These bridges were named to be informative -## however they can be named what ever you like and is adaptable to any network infrastructure -## environment. This file serves as an example of how to setup basic networking and was ONLY -## built for the purpose of being an example and used expressly in the building of an ALL IN -## ONE development environment. - -auto br-mgmtA -iface br-mgmtA inet static - bridge_stp off - bridge_waitport 0 - bridge_fd 0 - # Notice the bridge port is the vlan tagged interface - bridge_ports none - address 10.1.1.1 - netmask 255.255.255.0 - offload-sg off - -auto br-storageA -iface br-storageA inet static - bridge_stp off - bridge_waitport 0 - bridge_fd 0 - bridge_ports none - address 10.1.2.1 - netmask 255.255.255.0 - offload-sg off - -auto br-replA -iface br-replA inet static - bridge_stp off - bridge_waitport 0 - bridge_fd 0 - bridge_ports none - address 10.1.3.1 - netmask 255.255.255.0 - offload-sg off - -auto br-mgmtB -iface br-mgmtB inet static - bridge_stp off - bridge_waitport 0 - bridge_fd 0 - # Notice the bridge port is the vlan tagged interface - bridge_ports none - address 10.1.11.1 - netmask 255.255.255.0 - offload-sg off - -auto br-storageB -iface br-storageB inet static - bridge_stp off - bridge_waitport 0 - bridge_fd 0 - bridge_ports none - address 10.1.12.1 - netmask 255.255.255.0 - offload-sg off - -auto br-replB -iface br-replB inet static - bridge_stp off - bridge_waitport 0 - bridge_fd 0 - bridge_ports none - address 10.1.13.1 - netmask 255.255.255.0 - offload-sg off diff --git a/tests/test-swift-functional.yml b/tests/test-swift-functional.yml index 17e85358..cb4fe381 100644 --- a/tests/test-swift-functional.yml +++ b/tests/test-swift-functional.yml @@ -1,5 +1,4 @@ - - +--- - name: Setup testing - run Swift functional tests hosts: swift_proxy[0] user: root @@ -101,7 +100,7 @@ - name: Install requirements for swift pip: requirements: "{{ item }}" - virtualenv: "{{ swift_bin | dirname }}" + virtualenv: "{{ swift_venv_bin | dirname }}" with_items: - "/opt/swift/test-requirements.txt" - name: Setup test.conf for testing @@ -115,3 +114,5 @@ args: chdir: "/opt/swift/" executable: "/bin/bash" + vars_files: + - playbooks/test-vars.yml diff --git a/tests/test-swift-interfaces.cfg.j2 b/tests/test-swift-interfaces.cfg.j2 deleted file mode 100644 index 4c15fef9..00000000 --- a/tests/test-swift-interfaces.cfg.j2 +++ /dev/null @@ -1,36 +0,0 @@ -## The default networking requires several bridges. These bridges were named to be informative -## however they can be named what ever you like and is adaptable to any network infrastructure -## environment. This file serves as an example of how to setup basic networking and was ONLY -## built for the purpose of being an example and used expressly in the building of an ALL IN -## ONE development environment. - -auto br-mgmt -iface br-mgmt inet static - bridge_stp off - bridge_waitport 0 - bridge_fd 0 - # Notice the bridge port is the vlan tagged interface - bridge_ports none - address 10.1.1.1 - netmask 255.255.255.0 - offload-sg off - -auto br-storage -iface br-storage inet static - bridge_stp off - bridge_waitport 0 - bridge_fd 0 - bridge_ports none - address 10.1.2.1 - netmask 255.255.255.0 - offload-sg off - -auto br-repl -iface br-repl inet static - bridge_stp off - bridge_waitport 0 - bridge_fd 0 - bridge_ports none - address 10.1.3.1 - netmask 255.255.255.0 - offload-sg off diff --git a/tests/test-vars-MR-A.yml b/tests/test-vars-MR-A.yml deleted file mode 100644 index 80ea2d45..00000000 --- a/tests/test-vars-MR-A.yml +++ /dev/null @@ -1,124 +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. - -# General Environment Settings -external_lb_vip_address: "{{ hostvars[groups['keystone_all'][0]]['ansible_ssh_host'] }}" -internal_lb_vip_address: "{{ hostvars[groups['keystone_all'][0]]['ansible_ssh_host'] }}" -debug: true - -# LXC Settings -lxc_net_address: 10.100.100.1 -lxc_net_netmask: 255.255.255.0 -lxc_net_dhcp_range: 10.100.100.2,10.100.100.99 -lxc_net_bridge: lxcbr0 -lxc_kernel_options: - - { key: 'fs.inotify.max_user_instances', value: 1024 } - -# Galera Settings -galera_root_password: secrete -galera_root_user: root -galera_server_id: "{{ inventory_hostname | string_2_int }}" -galera_wsrep_node_name: "{{ inventory_hostname }}" -galera_innodb_buffer_pool_size: 512M -galera_innodb_log_buffer_size: 32M -galera_wsrep_provider_options: - - { option: "gcache.size", value: "32M" } -galera_server_id: "{{ inventory_hostname | string_2_int }}" - -# Memcache Settings -memcached_listen: "{{ hostvars[groups['memcached_all'][0]]['ansible_ssh_host'] }}" -memcached_servers: "{{ hostvars[groups['memcached_all'][0]]['ansible_ssh_host'] }}" -memcached_encryption_key: "secrete" - -# Network interface settings -interfaces_file: "test-swift-MR-interfaces.cfg.j2" -bridges: - - br-mgmtA - - br-storageA - - br-replA - - br-mgmtB - - br-storageB - - br-replB - -# Keystone Settings -keystone_messaging_enabled: false -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_password: "secrete" -keystone_galera_database: keystone -keystone_galera_address: "{{ hostvars[groups['galera_all'][0]]['ansible_ssh_host'] }}" -keystone_container_mysql_password: "SuperSecrete" -keystone_venv_tag: "testing" -keystone_developer_mode: true -keystone_git_install_branch: master -keystone_requirements_git_install_branch: master -keystone_service_region: RegionOne -keystone_httpd_mpm_thread_limit: 20 -keystone_httpd_mpm_min_spare_threads: 2 -keystone_httpd_mpm_max_spare_threads: 10 - -# Optimization for MR Swift memory usage -keystone_wsgi_processes: 2 -swift_account_server_workers: 2 -swift_container_server_workers: 2 -swift_object_server_workers: 2 -swift_proxy_server_workers: 2 - -# Swift specific settings -swift_storage_address: "{{ ansible_ssh_host }}" -swift_container_mysql_password: "SuperSecrete" -swift_dispersion_password: "secrete" -swift_hash_path_prefix: "secrete_prefx" -swift_hash_path_suffix: "secrete_suffix" -swift_service_password: "secrete" -swift_developer_mode: true -swift_git_install_branch: master -swift_venv_tag: untagged -swift_bin: "/openstack/venvs/swift-{{ swift_venv_tag }}/bin" -swift_service_publicuri: "http://{{ hostvars[groups['swift_proxy'][0]]['ansible_ssh_host'] }}:8080" -swift_service_adminuri: "http://{{ hostvars[groups['swift_proxy'][0]]['ansible_ssh_host'] }}:8080" -swift_service_internaluri: "http://{{ hostvars[groups['swift_proxy'][0]]['ansible_ssh_host'] }}:8080" -swift_replication_address: "{{ replication_address }}" -swift: - storage_network: eth1 - replication_network: eth3 - part_power: 8 - region: 1 - drives: - - name: swift1 - - name: swift2 - mount_point: /openstack - storage_policies: - - policy: - name: gold - index: 0 - repl_number: 3 - default: True -swift_proxy_server_conf_overrides: - "filter:keystoneauth": - reseller_prefix: "AUTH, SERVICE" - "SERVICE_service_roles": "test5" - -# openrc settings -openrc_os_password: "{{ keystone_auth_admin_password }}" -openrc_os_domain_name: "Default" -openrc_os_auth_url: "http://{{ internal_lb_vip_address }}:5000/v3" diff --git a/tests/test-vars-MR-B.yml b/tests/test-vars-MR-B.yml deleted file mode 100644 index 3e42120e..00000000 --- a/tests/test-vars-MR-B.yml +++ /dev/null @@ -1,124 +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. - -# General Environment Settings -external_lb_vip_address: "{{ hostvars[groups['keystone_all'][0]]['ansible_ssh_host'] }}" -internal_lb_vip_address: "{{ hostvars[groups['keystone_all'][0]]['ansible_ssh_host'] }}" -debug: true - -# LXC Settings -lxc_net_address: 10.100.100.1 -lxc_net_netmask: 255.255.255.0 -lxc_net_dhcp_range: 10.100.100.2,10.100.100.99 -lxc_net_bridge: lxcbr0 -lxc_kernel_options: - - { key: 'fs.inotify.max_user_instances', value: 1024 } - -# Galera Settings -galera_root_password: secrete -galera_root_user: root -galera_server_id: "{{ inventory_hostname | string_2_int }}" -galera_wsrep_node_name: "{{ inventory_hostname }}" -galera_innodb_buffer_pool_size: 512M -galera_innodb_log_buffer_size: 32M -galera_wsrep_provider_options: - - { option: "gcache.size", value: "32M" } -galera_server_id: "{{ inventory_hostname | string_2_int }}" - -# Memcache Settings -memcached_listen: "{{ hostvars[groups['memcached_all'][0]]['ansible_ssh_host'] }}" -memcached_servers: "{{ hostvars[groups['memcached_all'][0]]['ansible_ssh_host'] }}" -memcached_encryption_key: "secrete" - -# Network interface settings -interfaces_file: "test-swift-MR-interfaces.cfg.j2" -bridges: - - br-mgmtA - - br-storageA - - br-replA - - br-mgmtB - - br-storageB - - br-replB - -# Keystone Settings -keystone_messaging_enabled: false -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_password: "secrete" -keystone_galera_database: keystone -keystone_galera_address: "{{ hostvars[groups['galera_all'][0]]['ansible_ssh_host'] }}" -keystone_container_mysql_password: "SuperSecrete" -keystone_venv_tag: "testing" -keystone_developer_mode: true -keystone_git_install_branch: master -keystone_requirements_git_install_branch: master -keystone_service_region: RegionOne -keystone_httpd_mpm_thread_limit: 20 -keystone_httpd_mpm_min_spare_threads: 2 -keystone_httpd_mpm_max_spare_threads: 10 - -# Optimization for MR Swift memory usage -keystone_wsgi_processes: 2 -swift_account_server_workers: 2 -swift_container_server_workers: 2 -swift_object_server_workers: 2 -swift_proxy_server_workers: 2 - -# Swift specific settings -swift_storage_address: "{{ ansible_ssh_host }}" -swift_container_mysql_password: "SuperSecrete" -swift_dispersion_password: "secrete" -swift_hash_path_prefix: "secrete_prefx" -swift_hash_path_suffix: "secrete_suffix" -swift_service_password: "secrete" -swift_developer_mode: true -swift_git_install_branch: master -swift_venv_tag: untagged -swift_bin: "/openstack/venvs/swift-{{ swift_venv_tag }}/bin" -swift_service_publicuri: "http://{{ hostvars[groups['swift_proxy'][0]]['ansible_ssh_host'] }}:8080" -swift_service_adminuri: "http://{{ hostvars[groups['swift_proxy'][0]]['ansible_ssh_host'] }}:8080" -swift_service_internaluri: "http://{{ hostvars[groups['swift_proxy'][0]]['ansible_ssh_host'] }}:8080" -swift_replication_address: "{{ replication_address }}" -swift: - storage_network: eth1 - replication_network: eth3 - part_power: 8 - region: 2 - drives: - - name: swift1 - - name: swift2 - mount_point: /openstack - storage_policies: - - policy: - name: gold - index: 0 - repl_number: 3 - default: True -swift_proxy_server_conf_overrides: - "filter:keystoneauth": - reseller_prefix: "AUTH, SERVICE" - "SERVICE_service_roles": "test5" - -# openrc settings -openrc_os_password: "{{ keystone_auth_admin_password }}" -openrc_os_domain_name: "Default" -openrc_os_auth_url: "http://{{ internal_lb_vip_address }}:5000/v3" diff --git a/tests/test-vars.yml b/tests/test-vars.yml deleted file mode 100644 index b6cd11dd..00000000 --- a/tests/test-vars.yml +++ /dev/null @@ -1,108 +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. - -# General Environment Settings -external_lb_vip_address: "{{ hostvars[groups['keystone_all'][0]]['ansible_ssh_host'] }}" -internal_lb_vip_address: "{{ hostvars[groups['keystone_all'][0]]['ansible_ssh_host'] }}" -debug: true - -# LXC Settings -lxc_net_address: 10.100.100.1 -lxc_net_netmask: 255.255.255.0 -lxc_net_dhcp_range: 10.100.100.2,10.100.100.99 -lxc_net_bridge: lxcbr0 -lxc_kernel_options: - - { key: 'fs.inotify.max_user_instances', value: 1024 } - -# Galera Settings -galera_root_password: secrete -galera_root_user: root -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 }}" - -# Memcache Settings -memcached_listen: "{{ hostvars[groups['memcached_all'][0]]['ansible_ssh_host'] }}" -memcached_servers: "{{ hostvars[groups['memcached_all'][0]]['ansible_ssh_host'] }}" -memcached_encryption_key: "secrete" - -# Network interface settings -interfaces_file: "test-swift-interfaces.cfg.j2" -bridges: - - br-mgmt - - br-storage - - br-repl - -# Keystone Settings -keystone_messaging_enabled: false -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_password: "secrete" -keystone_galera_database: keystone -keystone_galera_address: "{{ hostvars[groups['galera_all'][0]]['ansible_ssh_host'] }}" -keystone_container_mysql_password: "SuperSecrete" -keystone_venv_tag: "testing" -keystone_developer_mode: true -keystone_git_install_branch: master -keystone_requirements_git_install_branch: master -keystone_service_region: RegionOne - -# Swift specific settings -swift_storage_address: "{{ ansible_ssh_host }}" -swift_container_mysql_password: "SuperSecrete" -swift_dispersion_password: "secrete" -swift_hash_path_prefix: "secrete_prefx" -swift_hash_path_suffix: "secrete_suffix" -swift_service_password: "secrete" -swift_developer_mode: true -swift_git_install_branch: master -swift_venv_tag: untagged -swift_bin: "/openstack/venvs/swift-{{ swift_venv_tag }}/bin" -swift_service_publicuri: "http://{{ hostvars[groups['swift_proxy'][0]]['ansible_ssh_host'] }}:8080" -swift_service_adminuri: "http://{{ hostvars[groups['swift_proxy'][0]]['ansible_ssh_host'] }}:8080" -swift_service_internaluri: "http://{{ hostvars[groups['swift_proxy'][0]]['ansible_ssh_host'] }}:8080" -swift_replication_address: "{{ replication_address }}" -swift: - storage_network: eth1 - replication_network: eth3 - part_power: 8 - drives: - - name: swift1 - - name: swift2 - mount_point: /openstack - storage_policies: - - policy: - name: gold - index: 0 - repl_number: 3 - default: True -swift_proxy_server_conf_overrides: - "filter:keystoneauth": - reseller_prefix: "AUTH, SERVICE" - "SERVICE_service_roles": "test5" - -# openrc settings -openrc_os_password: "{{ keystone_auth_admin_password }}" -openrc_os_domain_name: "Default" -openrc_os_auth_url: "http://{{ internal_lb_vip_address }}:5000/v3" diff --git a/tests/test.yml b/tests/test.yml index 7134007e..b90758c2 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -13,23 +13,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Prepare the user ssh keys -- include: test-prepare-keys.yml +# Setup the keys, host and containers +- include: playbooks/test-setup-host.yml -# Prepare the host -- include: test-prepare-host.yml - -# Prepare the containers -- include: test-prepare-containers.yml - -# Install MariaDB/Memcached -- include: test-install-infra.yml +# Install Memcached/Galera/Rabbitmq +- include: playbooks/test-install-infra.yml # Install Keystone -- include: test-install-keystone.yml - -# Setup Swift hosts -- include: test-setup-swifthosts.yml +- include: playbooks/test-install-keystone.yml # Install Swift -- include: test-install-swift.yml +- include: playbooks/test-install-swift.yml diff --git a/tox.ini b/tox.ini index 28ed5045..d8827574 100644 --- a/tox.ini +++ b/tox.ini @@ -97,7 +97,7 @@ commands = [testenv:ansible] deps = {[testenv]deps} - ansible==1.9.4 + ansible==2.1.1 ansible-lint>=2.7.0,<3.0.0 setenv = {[testenv]setenv} @@ -116,6 +116,7 @@ setenv = # This is required as the default is '/etc/ansible/roles' or a path # specified in ansible.cfg ANSIBLE_ROLES_PATH = {homedir}/.ansible/roles:{toxinidir}/.. + ANSIBLE_TRANSPORT = "ssh" commands = rm -rf {homedir}/.ansible/plugins git clone https://git.openstack.org/openstack/openstack-ansible-plugins \ @@ -124,6 +125,9 @@ commands = ansible-galaxy install \ --role-file={toxinidir}/tests/ansible-role-requirements.yml \ --force + rm -rf {toxinidir}/tests/playbooks + git clone https://git.openstack.org/openstack/openstack-ansible-tests \ + {toxinidir}/tests/playbooks [testenv:ansible-syntax] @@ -136,7 +140,7 @@ commands = ansible-playbook -i {toxinidir}/tests/inventory \ --syntax-check \ --list-tasks \ - -e "rolename={toxinidir}" \ + -e "swift_rolename={toxinidir}" \ {toxinidir}/tests/test.yml @@ -180,14 +184,14 @@ setenv = commands = {[testenv:ansible]commands} ansible-playbook -i {toxinidir}/tests/inventory \ - -e "rolename={toxinidir}" \ + -e "swift_rolename={toxinidir}" \ -e "install_test_packages=True" \ - -e @{toxinidir}/tests/test-vars.yml \ + -e @{toxinidir}/tests/swift-overrides.yml \ {toxinidir}/tests/test.yml -vvvv ansible-playbook -i {toxinidir}/tests/inventory \ - -e "rolename={toxinidir}" \ + -e "swift_rolename={toxinidir}" \ -e "install_test_packages=True" \ - -e @{toxinidir}/tests/test-vars.yml \ + -e @{toxinidir}/tests/swift-overrides.yml \ {toxinidir}/tests/test-swift-functional.yml -vvvv {[testenv:func_logs]commands} @@ -208,15 +212,15 @@ setenv = commands = {[testenv:ansible]commands} ansible-playbook -i {toxinidir}/tests/inventory \ - -e "rolename={toxinidir}" \ + -e "swift_rolename={toxinidir}" \ -e "install_test_packages=True" \ - -e @{toxinidir}/tests/test-vars.yml \ + -e @{toxinidir}/tests/swift-overrides.yml \ -e "swift_pypy_enabled=True" \ {toxinidir}/tests/test.yml -vvvv ansible-playbook -i {toxinidir}/tests/inventory \ - -e "rolename={toxinidir}" \ + -e "swift_rolename={toxinidir}" \ -e "install_test_packages=True" \ - -e @{toxinidir}/tests/test-vars.yml \ + -e @{toxinidir}/tests/swift-overrides.yml \ -e "swift_pypy_enabled=True" \ {toxinidir}/tests/test-swift-functional.yml -vvvv {[testenv:func_logs]commands} @@ -240,48 +244,38 @@ commands = # Setup the host and Region A # NB we run against swift_all only since region B hosts don't exist yet. ansible-playbook -i {toxinidir}/tests/inventory_MR_A \ - -e "rolename={toxinidir}" \ + -e "swift_rolename={toxinidir}" \ -e "install_test_packages=True" \ -e "swift_do_setup=True" \ -e "swift_do_sync=False" \ -e "swift_groups='swift_all'" \ - -e @{toxinidir}/tests/test-vars-MR-A.yml \ + -e @{toxinidir}/tests/swift-overrides-MR-A.yml \ {toxinidir}/tests/test.yml -vvvv - # Setup region B + # Setup region B Swift only and sync rings. ansible-playbook -i {toxinidir}/tests/inventory_MR_B \ - -e "rolename={toxinidir}" \ + -e "swift_rolename={toxinidir}" \ -e "install_test_packages=True" \ - -e "swift_do_setup=True" \ - -e "swift_do_sync=False" \ - -e @{toxinidir}/tests/test-vars-MR-B.yml \ - {toxinidir}/tests/test.yml -vvvv + -e @{toxinidir}/tests/swift-overrides-MR-B.yml \ + {toxinidir}/tests/playbooks/test-install-swift.yml -vvvv # Sync rings from region A ansible-playbook -i {toxinidir}/tests/inventory_MR_A \ - -e "rolename={toxinidir}" \ + -e "swift_rolename={toxinidir}" \ -e "install_test_packages=True" \ -e "swift_do_setup=False" \ -e "swift_do_sync=True" \ - -e @{toxinidir}/tests/test-vars-MR-A.yml \ - {toxinidir}/tests/test-install-swift.yml -vvvv - # Sync rings from region B - ansible-playbook -i {toxinidir}/tests/inventory_MR_B \ - -e "rolename={toxinidir}" \ - -e "install_test_packages=True" \ - -e "swift_do_setup=False" \ - -e "swift_do_sync=True" \ - -e @{toxinidir}/tests/test-vars-MR-B.yml \ - {toxinidir}/tests/test-install-swift.yml -vvvv + -e @{toxinidir}/tests/swift-overrides-MR-A.yml \ + {toxinidir}/tests/playbooks/test-install-swift.yml -vvvv # Run functional tests against region A ansible-playbook -i {toxinidir}/tests/inventory_MR_A \ - -e "rolename={toxinidir}" \ + -e "swift_rolename={toxinidir}" \ -e "install_test_packages=True" \ - -e @{toxinidir}/tests/test-vars-MR-A.yml \ + -e @{toxinidir}/tests/swift-overrides-MR-A.yml \ {toxinidir}/tests/test-swift-functional.yml -vvvv # Run functional tests against region B ansible-playbook -i {toxinidir}/tests/inventory_MR_B \ - -e "rolename={toxinidir}" \ + -e "swift_rolename={toxinidir}" \ -e "install_test_packages=True" \ - -e @{toxinidir}/tests/test-vars-MR-B.yml \ + -e @{toxinidir}/tests/swift-overrides-MR-B.yml \ {toxinidir}/tests/test-swift-functional.yml -vvvv {[testenv:func_logs]commands}