From b8398c4737c1687040649786346e5c2088d1ae66 Mon Sep 17 00:00:00 2001 From: Rafael Guterres Jeffman <rjeffman@redhat.com> Date: Tue, 1 Sep 2020 12:13:49 -0300 Subject: [PATCH] Enable ansible-lint Github action on every push. By running ansible-lint we check if playbooks provided in ansible-freipa follow Ansible's best practices, nd the verification will be performed on every push (even on forks) or pull-request. This patch provides the configuration needed to run ansible-lint to the playbooks found in the `tests`, `playbooks` and `molecule` directories, on every push or pull-request done on Github, using Ansible's Github Action ansible/ansible-lint-action. --- .ansible-lint | 23 +++++++++++++++++++++++ .github/workflows/lint.yml | 27 +++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 .ansible-lint create mode 100644 .github/workflows/lint.yml diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 00000000..b5f26cad --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,23 @@ +exclude_paths: + - roles + - .tox + - .venv + +parseable: true + +quiet: false + +skip_list: + - '201' # Trailing whitespace + - '204' # Lines should be no longer than 160 chars + - '206' # Variables should have spaces before and after: {{ var_name }}' + - '208' # File permissions not mentioned + - '301' # Commands should not change things if nothing needs doing' + - '305' # Use shell only when shell functionality is required' + - '306' # Shells that use pipes should set the pipefail option' + - '502' # All tasks should be named + - '505' # Referenced missing file + +use_default_rules: true + +verbosity: 1 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..053ce65e --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,27 @@ +--- +name: Run Linters +on: + - push + - pull_request +jobs: + linters: + name: Run Linters + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: "3.6" + + - name: Run ansible-lint + uses: ansible/ansible-lint-action@master + with: + targets: | + tests/*.yml + tests/*/*.yml + tests/*/*/*.yml + playbooks/*.yml + playbooks/*/*.yml + env: + ANSIBLE_MODULE_UTILS: plugins/module_utils + ANSIBLE_LIBRARY: plugins/modules -- GitLab