openstack-zuul-jobs/playbooks/infra-puppet-beaker-rspec/run.yaml

54 lines
1.8 KiB
YAML

- hosts: all
name: Beaker-rspec functional testing for Infra puppet modules
roles:
- bindep
tasks:
- name: Set up SSH for beaker
shell:
cmd: |
echo "" | sudo tee -a /etc/ssh/sshd_config
echo "Match address 127.0.0.1" | sudo tee -a /etc/ssh/sshd_config
echo " PermitRootLogin without-password" | sudo tee -a /etc/ssh/sshd_config
echo "" | sudo tee -a /etc/ssh/sshd_config
echo "Match address ::1" | sudo tee -a /etc/ssh/sshd_config
echo " PermitRootLogin without-password" | sudo tee -a /etc/ssh/sshd_config
mkdir -p ~/.ssh
ssh-keygen -f ~/.ssh/id_rsa -b 2048 -P ""
sudo mkdir -p /root/.ssh
cat ~/.ssh/id_rsa.pub | sudo tee -a /root/.ssh/authorized_keys
if [ -f /usr/bin/yum ]; then
sudo systemctl reload sshd
elif [ -f /usr/bin/apt-get ]; then
sudo service ssh restart
fi
- name: Create local gems directory
file:
state: directory
path: '{{ ansible_user_dir }}/.bundled_gems'
- name: Install ruby dependencies
become: yes
shell:
cmd: |
if [ -f /usr/bin/yum ]; then
yum install ruby-devel gcc-c++ -y
elif [ -f /usr/bin/apt-get ]; then
apt-get install ruby-dev -y
fi
- name: Execute acceptance tests
shell:
cmd: |
gem install bundler --no-rdoc --no-ri --verbose
$GEM_HOME/bin/bundle install --retry 3
export BEAKER_set={{ nodeset }}
export BEAKER_debug=yes
export BEAKER_color=no
$GEM_HOME/bin/bundle exec rspec spec/acceptance
chdir: "{{ zuul.project.src_dir }}"
environment:
'GEM_HOME': "{{ ansible_user_dir }}/.bundled_gems"