blob: fc25e8102ecee5351bd832699fd56d488ddf9e04 [file] [log] [blame]
Zack Williams2894e4f2020-09-17 09:45:17 -07001# users Makefile
2#
3# SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
4# SPDX-License-Identifier: Apache-2.0
5
6SHELL = bash -eu -o pipefail
7
8.DEFAULT_GOAL := help
9.PHONY: test lint yamllint ansiblelint license help passwd
10
11passwd: ## encrypt a password using required hash types
12 python goodpassword.py
13
14test: ## run tests on the playbook with molecule
15 molecule --version
16 molecule test
17
18lint: yamllint ansiblelint ## run all lint checks
19
20# all YAML files
21YAML_FILES ?= $(shell find . -type f \( -name '*.yaml' -o -name '*.yml' \) -print )
22
23yamllint: ## lint check with yamllint
24 yamllint --version
25 yamllint \
26 -d "{extends: default, rules: {line-length: {max: 99}}}" \
27 -s $(YAML_FILES)
28
Wei-Yu Chen46a7e9f2022-04-11 21:49:42 +080029# List of molecule files, not including base molecule.yml which isn't ansible format
30MOLECULE_FILES ?= $(shell find molecule -type f -name '*.yml' \! -name 'molecule.yml' -print )
31
Zack Williams2894e4f2020-09-17 09:45:17 -070032ansiblelint: ## lint check with ansible-lint
33 ansible-lint --version
34 ansible-lint -v .
Wei-Yu Chen46a7e9f2022-04-11 21:49:42 +080035 ansible-lint -v $(MOLECULE_FILES)
Zack Williams2894e4f2020-09-17 09:45:17 -070036
37license: ## Check license with the reuse tool
38 reuse --version
39 reuse --root . lint
40
41help: ## Print help for each target
42 @echo users test targets
43 @echo
44 @grep '^[[:alnum:]_-]*:.* ##' $(MAKEFILE_LIST) \
45 | sort | awk 'BEGIN {FS=":.* ## "}; {printf "%-25s %s\n", $$1, $$2};'