Commit 5b3363e5 authored by John Hackett's avatar John Hackett

Add example tests, invoke from makefile-built dockerfile for inspec. Renamed...

Add example tests, invoke from makefile-built dockerfile for inspec. Renamed apt-cache-ng docker container.
parent af1c204a
......@@ -4,12 +4,22 @@ destroy:
apply:
terraform apply -auto-approve
#
#docker-apply:
# docker run -it --rm -v $(PWD) terraform-lxd apply -auto-approve
docker:
cat dockerfiles/apt-cache-ng | docker build -t apt-cache-ng -
cat dockerfiles/inspec | docker build -t inspec -
cat dockerfiles/terraform-lxd | docker build -t terraform-lxd -
build: apply ansible
ansible:
ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i `terraform output -json | jq -r .ip.value`, playbook.yml -u root
rebuild: destroy build ansible
rebuild: destroy apply ansible
apt-cache:
cat dockerfiles/apt-cacher-ng | docker build -t apt-cacher-ng -
......@@ -22,11 +32,11 @@ provision:
cd ./scripts/ && bundle install --path ../.ruby-vendor && bundle exec ruby provision.rb
test:
docker run -it --rm -v $(HOME)/.ssh:/keys -v $(PWD)/tests:/share chef/inspec exec -b ssh --host=$(tf_output_ip) -i /keys/id_rsa /share
docker run -it --rm -v $(HOME)/.ssh:/keys -v $(PWD)/tests:/share inspec exec base_spec.rb -b ssh --no-create-lockfile --host=`terraform output -json | jq -r .ip.value` -i /keys/id_rsa
image:
virt-builder debian-9 --root-password password:super-secret-password-123 --format qcow2
prep: image apt-cache
.PHONY: apt-cache converge
.PHONY: apt-cache converge
\ No newline at end of file
FROM ruby:alpine
MAINTAINER Chef Software, Inc. <docker@chef.io>
ARG VERSION=1.51.15
ARG GEM_SOURCE=https://rubygems.org
RUN mkdir -p /share
RUN apk add --update build-base libxml2-dev libffi-dev && \
gem install --no-document --source ${GEM_SOURCE} --version ${VERSION} inspec && \
apk del build-base
ENTRYPOINT ["inspec"]
CMD ["help"]
VOLUME ["/share"]
WORKDIR /share
\ No newline at end of file
FROM golang:alpine
ENV TERRAFORM_VERSION=0.11.2
RUN apk add --update git bash openssh unzip wget
ENV TF_DEV=true
ENV TF_RELEASE=true
WORKDIR $GOPATH/src/github.com/hashicorp/terraform
RUN git clone https://github.com/hashicorp/terraform.git ./ && \
git checkout v${TERRAFORM_VERSION} && \
/bin/bash scripts/build.sh
RUN wget https://github.com/sl1pm4t/terraform-provider-lxd/releases/download/v1.1.0/terraform-provider-lxd_v1.1.0_linux_amd64.zip && \
unzip -d /go/bin/ terraform-provider-lxd_v1.1.0_linux_amd64.zip
WORKDIR /share
#ENTRYPOINT ["terraform"]
\ No newline at end of file
describe file('/etc/myapp.conf') do
it { should exist }
its('mode') { should cmp 0644 }
end
\ No newline at end of file
describe sshd_config do
its('Port') { should eq('22') }
end
describe port(9869) do
it { should be_listening }
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment