forked from schubergphilis/SLES12-CIS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
64 lines (57 loc) · 1.58 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Makefile for SLES12-CIS
.PHONY: help
help:
@echo
@echo This Makefile is used to test this role. Typical use:
@echo
@echo ' make test'
@echo ' make clean'
@echo ' make compare'
@echo
@echo
@echo To use the isolated environment from this directory:
@echo
@echo ' make venv'
@echo ' . bin/activate'
@echo
@echo Molecule has built-in help
@echo
@echo ' molecule'
@echo
@echo "Run just the role 'molecule converge'"
@echo "Login to the VM 'molecule login'"
@echo
@echo To run an audit using 'molecule verify' see tests/test_default.yml
@echo To compare audit results between setups with docker vs vagrant run 'make compare'
# virtualenv allows isolation of python libraries
.PHONY: venv
venv: bin/python
bin/python:
## System's python 2.7 needs only 2 things:
# pip is the package manager for python
pip -V || sudo easy_install pip
# virtualenv allows isolation of python libraries
virtualenv --version || sudo easy_install virtualenv
# Now with those two we can isolate our test setup.
virtualenv .
bin/pip install -r requirements.txt
virtualenv --relocatable .
# cleanup virtualenv and molecule leftovers
clean:
rm -rf .molecule bin lib include lib64 share .vagrant
rm -f .Python pip-selfcheck.json
.PHONY: lint
lint: bin/python
( . bin/activate && find . -name "*.yml" |grep -v .molecule |xargs bin/yamllint )
.PHONY: test
test: bin/python
( . bin/activate && bin/molecule test )
.PHONY: compare
compare:
rm -rf .molecule
cp vagrant.yml molecule.yml
molecule test
rm -rf .molecule
cp docker.yml molecule.yml
molecule test
diff tests/vagrant.txt tests/docker.txt