Fix asserts and run ansible by distros

This commit is contained in:
Paul Montero
2017-09-19 22:35:13 -05:00
parent eaa1c80c1e
commit 0eb3277351
3 changed files with 22 additions and 12 deletions

View File

@@ -21,7 +21,9 @@ before_install:
script:
- cd tests
- docker-compose up -d
- ansible-playbook user.yml
- ansible-playbook user.yml -l centos
- ansible-playbook user.yml -l debian
- ansible-playbook user.yml -l ubuntu
before_cache:
- >

View File

@@ -1,34 +1,40 @@
---
- name: Check that ruby exists
command: ruby -v
shell: . $HOME/.bash_profile && ruby -v | cut -c1-4
args:
executable: /bin/bash
register: check_ruby
changed_when: false
- assert:
that:
- "{{ check_ruby.stdout }} == 'ruby'"
- "{{ check_ruby.rc }} == 0 "
msg: No ruby test pass
- check_ruby.stdout == 'ruby'
- check_ruby.rc == 0
msg: No ruby installed
- name: Check default ruby
shell: ~/.rvm/wrappers/default/ruby -v | cut -c1-10
register: check_ruby_default
changed_when: false
- assert:
that:
- "{{ check_ruby_default.stdout }} == 'ruby 2.3.1'"
msg: Default ruby test pass
- check_ruby_default.stdout == 'ruby 2.3.1'
msg: No default ruby installed
- name: Check multiple rubies
command: ls ~/.rvm/rubies
register: check_ruby_multiple
changed_when: false
- assert:
that:
- "ruby-2.2.5' in {{ check_ruby_multiple.stdout }}"
- "ruby-2.3.1' in {{ check_ruby_multiple.stdout }}"
msg: Multiple rubies test pass
- "'ruby-2.2.5' in check_ruby_multiple.stdout"
- "'ruby-2.3.1' in check_ruby_multiple.stdout"
msg: No multiple rubies installed
- name: Check bundler symlinked on system path
shell: ls ~/.rvm/wrappers/default/ |grep 'bundler'
register: check_ruby_bundler
changed_when: false
- assert:
that:
- "{{ check_ruby_bundler.stdout }} == 'bundler'"
msg: Bundler symlinked on system path test pass
- check_ruby_bundler.stdout == 'bundler'
msg: No bundler symlinked on system path

View File

@@ -1,6 +1,7 @@
---
- hosts: all
gather_facts: false
remote_user: user
vars:
rvm1_user: user
rvm1_install_path: '/home/{{ rvm1_user }}/.rvm'
@@ -14,6 +15,7 @@
# Asserts tasks
- hosts: all
gather_facts: false
remote_user: user
tasks:
- name: Assert tasks
include: assertions.yml