# serverspec-poc

This is the begining of sanity checks pre-builds to validate systems related components are up and running.

To add additional checks, please check out the code from this repo and follow the following instructions listed below.

### Contributing

#### Adding a new host

```
$ serverspec-init

Select OS type:

	1) UN*X
	2) Windows

  Select number: 1

Select a backend type:
	1) SSH
	2) Exec (local)

  Select number: 1

Vagrant instance y/n: n
```

#### Adding a new check to preexisting host

To create a new check to an existing [*_spec.rb](./spec/) file, follow the below structure:

```ruby
describe service("httpd"), :if => os[:family] == "redhat" do
  it { should be_enabled }
  it { should be_running }
end
```

#### Development Tasks

0. To execute pre-commit rake task (basic auto-lint, etc.) run:

  ```
  $ rake
  ```

0. To execute all serverspecs run:

  ```
  $ rake spec
  ```

0. To view all tasks run:

  ```
  $ rake -T
  ```

#### Jenkins

On CI servers, no need to do a full `bundle install`. Instead do:

  ```
  $ bundle install --without development
  ```

So it only installs runtime dependencies, and not dev dependencies.

#### Sensu readable output

After doing a `bundle install`, run

```
$ check-serverspec -d /root/serverspec-poc -t spec/infra
```
