From c05a7233ec9a846a0c53bdb6af6d465a371f9f96 Mon Sep 17 00:00:00 2001
From: Rafael Guterres Jeffman <rjeffman@redhat.com>
Date: Tue, 1 Sep 2020 12:50:48 -0300
Subject: [PATCH] Enable yaml-lint Github action on push/pull-requests.

By running yamllint we add one more verification of quality to the
playbooks used on/provided by ansible-freeipa, that will be executed
on every push (even on forks) or pull-requests.

This patch provides the configuration needed to run yamllint on
the playbooks found in the `tests`, `playbooks` and `molecule`
directories, on every push or pull-request done on Github, using
ibiqlik/action-yamllint action version `v1`.

The current configuration for yamllint has many rules disable, so
the problems found can be fixed later. All rules after the comment
`# Disabled rules` should be enabled in the near future.
---
 .github/workflows/lint.yml |  4 ++++
 .yamllint                  | 28 ++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)
 create mode 100644 .yamllint

diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 053ce65e..403edaaa 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -25,3 +25,7 @@ jobs:
         env:
           ANSIBLE_MODULE_UTILS: plugins/module_utils
           ANSIBLE_LIBRARY: plugins/modules
+
+      - name: Run yaml-lint
+        uses: ibiqlik/action-yamllint@v1
+
diff --git a/.yamllint b/.yamllint
new file mode 100644
index 00000000..3671e728
--- /dev/null
+++ b/.yamllint
@@ -0,0 +1,28 @@
+---
+ignore: |
+  /.tox/
+  /.venv/
+  /.github/
+
+extends: default
+
+rules:
+  braces:
+    max-spaces-inside: 1
+    level: error
+  brackets:
+    max-spaces-inside: 1
+    level: error
+  truthy:
+    allowed-values: ["yes", "no", "true", "false", "True", "False"]
+    level: error
+  # Disabled rules
+  document-start: disable
+  indentation: disable
+  line-length: disable
+  colons: disable
+  empty-lines: disable
+  comments: disable
+  comments-indentation: disable
+  trailing-spaces: disable
+  new-line-at-end-of-file: disable
-- 
GitLab