From 9e712e65d3504f0a4c8c59ce3b20b6a318f6d499 Mon Sep 17 00:00:00 2001 From: Tobias Bauriedel Date: Wed, 18 Sep 2024 17:19:22 +0200 Subject: [PATCH] add basic linter --- .github/workflows/linting.yml | 34 +++++++++++++++++++++++++++++++++ .yamllint | 6 ++++++ README.md | 2 ++ ansible/playbook.yml | 4 ++-- ansible/vars/icinga2.yml | 2 +- ansible/vars/icingadb_redis.yml | 2 +- ansible/vars/icingaweb2.yml | 2 +- 7 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/linting.yml create mode 100644 .yamllint diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml new file mode 100644 index 0000000..c29791e --- /dev/null +++ b/.github/workflows/linting.yml @@ -0,0 +1,34 @@ +--- +name: Linting + +on: + push: + branches: + - "main" + pull_request: + branches: + - "*" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + + - name: Set up Python 3. + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Install test dependencies + run: | + python3 -m pip install --upgrade pip + python3 -m pip install ansible-core ansible-lint yamllint + + - name: yamllint + run: yamllint . + + - name: ansible-lint + run: ansible-lint . diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..146a545 --- /dev/null +++ b/.yamllint @@ -0,0 +1,6 @@ +--- +extends: relaxed +rules: + line-length: + max: 150 + level: warning diff --git a/README.md b/README.md index 620d27a..3385c97 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +![Lint](https://github.com/tbauriedel/vagrant-icinga-dev/actions/workflows/linting.yml/badge.svg) + # vagrant-icinga-dev Vagrantfile with ansible provisioner. diff --git a/ansible/playbook.yml b/ansible/playbook.yml index 48b1345..5f44433 100644 --- a/ansible/playbook.yml +++ b/ansible/playbook.yml @@ -6,7 +6,7 @@ - name: Include vars ansible.builtin.include_vars: dir: vars - extensions: + extensions: - "yml" - "yaml" @@ -29,7 +29,7 @@ state: started enabled: true when: ansible_os_family == "RedHat" - + roles: - tbauriedel.gographite.gocarbon - tbauriedel.gographite.carbonapi diff --git a/ansible/vars/icinga2.yml b/ansible/vars/icinga2.yml index 0193851..f9003f2 100644 --- a/ansible/vars/icinga2.yml +++ b/ansible/vars/icinga2.yml @@ -37,4 +37,4 @@ icinga2_objects: file: "zones.d/main/apiuser.conf" password: poweruser permissions: - - '*' \ No newline at end of file + - '*' diff --git a/ansible/vars/icingadb_redis.yml b/ansible/vars/icingadb_redis.yml index 6cf32e5..03eae39 100644 --- a/ansible/vars/icingadb_redis.yml +++ b/ansible/vars/icingadb_redis.yml @@ -1,2 +1,2 @@ --- -icingadb_redis_password: redis-pass \ No newline at end of file +icingadb_redis_password: redis-pass diff --git a/ansible/vars/icingaweb2.yml b/ansible/vars/icingaweb2.yml index 1de04c7..c7379b3 100644 --- a/ansible/vars/icingaweb2.yml +++ b/ansible/vars/icingaweb2.yml @@ -60,4 +60,4 @@ icingaweb2_modules: password: redis-pass icingaweb2_admin_username: icinga -icingaweb2_admin_password: icinga \ No newline at end of file +icingaweb2_admin_password: icinga