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: script:
- cd tests - cd tests
- docker-compose up -d - 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: before_cache:
- > - >

View File

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

View File

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