mirror of
https://github.com/dj-wasabi/ansible-telegraf.git
synced 2025-07-17 08:46:37 +00:00
Apply ansible-lint in pre-commit hook and fix changes
This commit is contained in:
@ -1,5 +1,14 @@
|
|||||||
---
|
---
|
||||||
repos:
|
repos:
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: ansible-lint
|
||||||
|
name: Ansible-lint
|
||||||
|
description: This hook runs ansible-lint.
|
||||||
|
entry: ansible-lint --force-color .
|
||||||
|
language: python
|
||||||
|
pass_filenames: false
|
||||||
|
always_run: true
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v3.2.0
|
rev: v3.2.0
|
||||||
hooks:
|
hooks:
|
||||||
|
@ -44,13 +44,14 @@ Style guides are important because they ensure consistency in the content, look,
|
|||||||
|
|
||||||
## (local) Development
|
## (local) Development
|
||||||
|
|
||||||
This role make use of Molecule to test the execution of the role and verificate it. In the root of the repository, a file named `requirements.txt` exists and contains the versions used by the tests.
|
This role make use of Molecule to test the execution of the role and verificate it. In the repository https://github.com/dj-wasabi/dj-wasabi-release, a file named `requirements.txt` exists and contains the versions used by the tests.
|
||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
|
|
||||||
You can install them with the following command:
|
You can install them with the following command:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
wget https://raw.githubusercontent.com/dj-wasabi/dj-wasabi-release/main/requirements.txt
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -67,6 +68,10 @@ It should run without any issues.
|
|||||||
|
|
||||||
# Other
|
# Other
|
||||||
|
|
||||||
|
## pre-commit
|
||||||
|
|
||||||
|
This repository contains a pre-commit hook. This means that when you want to commit the changes, 1 or more tests are executed to validate the changes. Please take a look at how to install the `pre-commit` package from the official [site](https://pre-commit.com/). Also make sure to install `ansible-lint` via `pip install ansible-lint` as this is 1 of the tools that is executed while a pre-commit hooks runs.
|
||||||
|
|
||||||
## Virtualenv
|
## Virtualenv
|
||||||
|
|
||||||
Suggestion is to create a virtualenv so you won't have issues with other projects.
|
Suggestion is to create a virtualenv so you won't have issues with other projects.
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
+ [telegraf_plugins_extra](#telegraf-plugins-extra)
|
+ [telegraf_plugins_extra](#telegraf-plugins-extra)
|
||||||
* [Dependencies](#dependencies)
|
* [Dependencies](#dependencies)
|
||||||
* [Example Playbook](#example-playbook)
|
* [Example Playbook](#example-playbook)
|
||||||
* [Contributors](#contributors)
|
|
||||||
* [Molecule](#molecule)
|
* [Molecule](#molecule)
|
||||||
* [License](#license)
|
* [License](#license)
|
||||||
* [Author Information](#author-information)
|
* [Author Information](#author-information)
|
||||||
|
@ -22,4 +22,4 @@
|
|||||||
state: restarted
|
state: restarted
|
||||||
|
|
||||||
- name: "Restart MacOS Telegraf"
|
- name: "Restart MacOS Telegraf"
|
||||||
shell: brew services restart telegraf
|
command: brew services restart telegraf
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
file:
|
file:
|
||||||
path: "{{ item.path }}"
|
path: "{{ item.path }}"
|
||||||
owner: "{{ item.owner }}"
|
owner: "{{ item.owner }}"
|
||||||
|
mode: 0755
|
||||||
state: directory
|
state: directory
|
||||||
with_items:
|
with_items:
|
||||||
- path: /etc/telegraf/telegraf.d/
|
- path: /etc/telegraf/telegraf.d/
|
||||||
|
@ -161,6 +161,7 @@
|
|||||||
marker: "# {mark} ANSIBLE MANAGED BLOCK (Ensure telegraf user can execute smartctl)"
|
marker: "# {mark} ANSIBLE MANAGED BLOCK (Ensure telegraf user can execute smartctl)"
|
||||||
dest: "/etc/sudoers.d/telegraf"
|
dest: "/etc/sudoers.d/telegraf"
|
||||||
block: "telegraf ALL=(root) NOPASSWD: {{ which_smartctl.stdout }}"
|
block: "telegraf ALL=(root) NOPASSWD: {{ which_smartctl.stdout }}"
|
||||||
|
mode: 0400
|
||||||
create: true
|
create: true
|
||||||
become: true
|
become: true
|
||||||
notify:
|
notify:
|
||||||
|
Reference in New Issue
Block a user