Colleen Murphy 656a86b25f Pin bundler for puppet rspec jobs
bundler 2.0 requires rubygems 3.0 which is not available by default on
Ubuntu and not compatible with the ruby version on CentOS 7.

Change-Id: Id19edd37dcdbaea058dbec60cb25d2ca7560bb46
2019-01-03 13:02:43 +01:00

55 lines
1.9 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-ri --no-rdoc --verbose --version '<2.0.0'
$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: "{{ project_src_dir }}"
environment:
'GEM_HOME': "{{ ansible_user_dir }}/.bundled_gems"
'PUPPET_VERSION': "{{ puppet_version | default('3') }}"