You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
2.1 KiB

- 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
if [ -f ~/.ssh/id_rsa ] ; then
# A key already exists, we'll use it but ensure it is in pem
# format for ruby's net-ssh
ssh-keygen -p -m PEM -f ~/.ssh/id_rsa -N '' -P ''
else
ssh-keygen -f ~/.ssh/id_rsa -b 2048 -P ""
fi
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('4') }}"