From 2fa5458994ec1b866cf5c97d56132b1ac7e17eb1 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Thu, 2 Aug 2018 11:06:14 -0500 Subject: [PATCH] Run ansible base playbook for puppet tests As we start to do things in the base playbook instead of in puppet, we need for those things to happen before we run puppet, and before we test final system state. Install ansible into a virtualenv, then run the base playbook. Change-Id: I88808dec9dd4ebdd3fb9081881d2ab69f9eed95e --- .../spec_helper_acceptance.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/puppet-openstack_infra_spec_helper/spec_helper_acceptance.rb b/lib/puppet-openstack_infra_spec_helper/spec_helper_acceptance.rb index 764b25c..52a8003 100755 --- a/lib/puppet-openstack_infra_spec_helper/spec_helper_acceptance.rb +++ b/lib/puppet-openstack_infra_spec_helper/spec_helper_acceptance.rb @@ -2,8 +2,15 @@ require 'beaker-rspec' SYSTEM_CONFIG='git.openstack.org/openstack-infra/system-config' +def run_ansible(host) + base_playbook = "#{ENV['HOME']}/src/#{SYSTEM_CONFIG}/playbooks/base.yaml" + on host, "echo 'localhost ansible_connection=local' > hosts" + on host, "virtualenv .ansiblevenv" + on host, ".ansiblevenv/bin/pip install ansible" + on host, ".ansiblevenv/bin/ansible-playbook -i hosts #{base_playbook}" +end + def install_infra_puppet(host) - install_system_config(host) on host, "bash -x #{ENV['HOME']}/src/#{SYSTEM_CONFIG}/install_puppet.sh", :environment => ENV.to_hash end @@ -66,6 +73,8 @@ end # Set up hosts, before running any tests hosts.each do |host| setup_host(host) + install_system_config(host) + run_ansible(host) install_infra_puppet(host) install_infra_modules(host, proj_root) end