Add tests and fix structure to prevent errors

This commit is contained in:
Timo Makinen 2022-01-30 02:33:50 +02:00
parent a057c34d94
commit 7b259dc86a
7 changed files with 26 additions and 3 deletions

View file

@ -30,4 +30,4 @@ if ! rpm -q ansible > /dev/null; then
fi
# run playbook
ansible-playbook deploy.yml
ansible-playbook playbooks/deploy.yml

View file

@ -7,7 +7,7 @@
become_method: sudo
vars_files:
- vars.yml
- ../vars/defaults.yml
roles:
- cups
@ -45,7 +45,7 @@
'/dev/null chars=ascii_lowercase,digits length=4'
)
}}
when: hostname_check.stdout == ""
when: not hostname_check.stdout
- name: remove unneeded packages
ansible.builtin.package:

7
tests/00-selfsanity.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")"
find . -maxdepth 1 -type f -name "*.sh" -print0 | xargs -0 -t -n 1 shellcheck --

6
tests/01-yamllint.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
cd "$(dirname "$0")/.." || exit 1
find . -type f -name "*.yml" -not -path "./roles/*" -print0 | \
xargs -0 -t -n 1 yamllint -s --

6
tests/02-ansiblelint.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
cd "$(dirname "$0")/.." || exit 1
find . -name "*.yml" -not -path "./roles/*" -print0 | \
xargs -0 -t -n 1 -- ansible-lint -x meta-no-info --

4
tests/Makefile Normal file
View file

@ -0,0 +1,4 @@
.PHONY = all
all:
@for x in *.sh ; do sh "$$x" || exit 1 ; done