Skip to content

i like serverspec .. do you ?? let's create a reusable role to easily copy tests from a role if they exists

Notifications You must be signed in to change notification settings

gkspranger/ansible-serverspec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

(Ansible+ServerSpec)*DRY=HappyUnicorn

I like Ansible .. I like ServerSpec .. Do you ?? But how can I:

  • Create tests for a role
  • Copy role tests to nodes that use said role
  • Be as DRY as possible

So here is my thought process:

  • Create roles how I normally create them
./roles/<my-awh-sum-role>/
  • Create tests for a role and put them in the role's "tests" directory
./roles/<my-awh-sum-role>/tests/*_spec.rb
  • Create a role that setups a basic ServerSpec project
./roles/serverspec/*
  • Create a role that will copy all tests from a referring role
./roles/test/*
  • Any role that has tests, create a dependency on the test role (in meta) with related vars
# this is in ./roles/<my-awh-sum-role>/meta/main.yml
---
dependencies:
  - role: test
    role_tests: <my-awh-sum-role>

Keywords

Ansible, ServerSpec, automation, automated testing, TDD, BDD, test, role, reusable, DRY

About

i like serverspec .. do you ?? let's create a reusable role to easily copy tests from a role if they exists

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages