Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add gitignore #2

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
offline: true
exclude_paths:
- .github/
- dev/
- docs/
- venv
- playbooks/meta
- tdp_lib_dag
- galaxy.yml

warn_list: []

skip_list:
- yaml[octal-values]
26 changes: 26 additions & 0 deletions .github/workflows/ansible-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Ansible Lint
on:
pull_request:
types: [opened, reopened, synchronize]
env:
NAMESPACE: tosit
COLLECTION_NAME: tdp_observability
ANSIBLE_COLLECTIONS_PATH: ${{ github.workspace }}
jobs:
ansible-lint:
runs-on: ubuntu-latest
steps:
- name: Check out TOSIT-IO/tdp-collection
uses: actions/checkout@v3
with:
repository: TOSIT-IO/tdp-collection
path: ansible_collections/${{env.NAMESPACE}}/tdp
- uses: actions/checkout@v3
with:
path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
- name: Setup venv for linting
run: dev/setup.sh
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
- name: Run ansible-lint
run: source venv/bin/activate && ansible-lint
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
10 changes: 10 additions & 0 deletions .github/workflows/conventional-commits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Conventional Commits
on:
pull_request:
types: [opened, reopened, synchronize]
jobs:
check-conventional-commits:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: webiny/action-conventional-commits@v1.0.3
11 changes: 11 additions & 0 deletions .github/workflows/license_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Check License Headers
on:
pull_request:
types: [opened, reopened, synchronize]
jobs:
check-license-headers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Check license headers
run: npx @kt3k/license-checker@3.2.2
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Visual Studio Code
.vscode
venv
10 changes: 10 additions & 0 deletions .licenserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"**/*.{py,yml,j2}": [
"# Copyright 2022 TOSIT.IO",
"# SPDX-License-Identifier: Apache-2.0"
],
"ignore": [
".github",
"venv"
]
}
8 changes: 8 additions & 0 deletions dev/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ansible-lint==6.17.2
ansible-core==2.15.1
jsonschema==4.18.0
braceexpand==0.1.7
termcolor==2.3.0
gitPython==3.1.38
passlib==1.7.4
jmespath==1.0.1
32 changes: 32 additions & 0 deletions dev/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

set -euo pipefail

readonly PYTHON_BIN=${PYTHON_BIN:-python3}
readonly PYTHON_VENV=${PYTHON_VENV:-venv}

setup_python_venv() {
if [[ ! -d "$PYTHON_VENV" ]]; then
echo "Create python venv with '${PYTHON_BIN}' to '${PYTHON_VENV}' and update pip to latest version"
"$PYTHON_BIN" -m venv "$PYTHON_VENV"
(
source "${PYTHON_VENV}/bin/activate"
pip install -U pip
)
else
echo "Python venv '${PYTHON_VENV}' already exists, nothing to do"
fi
echo "Install python dependencies"
(
source "${PYTHON_VENV}/bin/activate"
pip install -r dev/requirements.txt
ansible-galaxy collection install community.general
)
return 0
}

main() {
setup_python_venv
}

main "$@"
6 changes: 3 additions & 3 deletions playbooks/exporter_node_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# SPDX-License-Identifier: Apache-2.0

---
- name: node-exporter install
- name: Node exporter install
hosts: exporter_node
tasks:
- tosit.tdp.resolve: # noqa unnamed-task
- tosit.tdp.resolve: # noqa name[missing]
node_name: exporter_node
- name: Install node exporter
ansible.builtin.import_role:
name: tosit.tdp_observability.exporter.node
tasks_from: install
- ansible.builtin.meta: clear_facts # noqa unnamed-task
- ansible.builtin.meta: clear_facts # noqa name[missing]
6 changes: 3 additions & 3 deletions playbooks/exporter_node_restart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# SPDX-License-Identifier: Apache-2.0

---
- name: node-exporter restart
- name: Node exporter restart
hosts: exporter_node
tasks:
- tosit.tdp.resolve: # noqa unnamed-task
- tosit.tdp.resolve: # noqa name[missing]
node_name: exporter_node
- name: Restart node exporter
ansible.builtin.import_role:
name: tosit.tdp_observability.exporter.node
tasks_from: restart
- ansible.builtin.meta: clear_facts # noqa unnamed-task
- ansible.builtin.meta: clear_facts # noqa name[missing]
6 changes: 3 additions & 3 deletions playbooks/exporter_node_start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# SPDX-License-Identifier: Apache-2.0

---
- name: node-exporter start
- name: Node exporter start
hosts: exporter_node
tasks:
- tosit.tdp.resolve: # noqa unnamed-task
- tosit.tdp.resolve: # noqa name[missing]
node_name: exporter_node
- name: Start node exporter
ansible.builtin.import_role:
name: tosit.tdp_observability.exporter.node
tasks_from: start
- ansible.builtin.meta: clear_facts # noqa unnamed-task
- ansible.builtin.meta: clear_facts # noqa name[missing]
8 changes: 4 additions & 4 deletions playbooks/exporter_node_status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# SPDX-License-Identifier: Apache-2.0

---
- name: node-exporter status
- name: Node exporter status
hosts: exporter_node
tasks:
- tosit.tdp.resolve: # noqa unnamed-task
- tosit.tdp.resolve: # noqa name[missing]
node_name: exporter_node
- name: node exporter status
- name: Node exporter status
ansible.builtin.import_role:
name: tosit.tdp_observability.exporter.node
tasks_from: status
- ansible.builtin.meta: clear_facts # noqa unnamed-task
- ansible.builtin.meta: clear_facts # noqa name[missing]
6 changes: 3 additions & 3 deletions playbooks/exporter_node_stop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# SPDX-License-Identifier: Apache-2.0

---
- name: node-exporter stop
- name: Node exporter stop
hosts: exporter_node
tasks:
- tosit.tdp.resolve: # noqa unnamed-task
- tosit.tdp.resolve: # noqa name[missing]
node_name: exporter_node
- name: Stop node exporter
ansible.builtin.import_role:
name: tosit.tdp_observability.exporter.node
tasks_from: stop
- ansible.builtin.meta: clear_facts # noqa unnamed-task
- ansible.builtin.meta: clear_facts # noqa name[missing]
6 changes: 3 additions & 3 deletions playbooks/exporter_postgres_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# SPDX-License-Identifier: Apache-2.0

---
- name: postgres-exporter install
- name: Postgres exporter install
hosts: exporter_postgres
tasks:
- tosit.tdp.resolve: # noqa unnamed-task
- tosit.tdp.resolve: # noqa name[missing]
node_name: exporter_postgres
- name: Install postgres exporter
ansible.builtin.import_role:
name: tosit.tdp_observability.exporter.postgres
tasks_from: install
- ansible.builtin.meta: clear_facts # noqa unnamed-task
- ansible.builtin.meta: clear_facts # noqa name[missing]
6 changes: 3 additions & 3 deletions playbooks/exporter_postgres_restart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# SPDX-License-Identifier: Apache-2.0

---
- name: postgres-exporter restart
- name: Postgres exporter restart
hosts: exporter_postgres
tasks:
- tosit.tdp.resolve: # noqa unnamed-task
- tosit.tdp.resolve: # noqa name[missing]
node_name: exporter_postgres
- name: Restart postgres exporter
ansible.builtin.import_role:
name: tosit.tdp_observability.exporter.postgres
tasks_from: restart
- ansible.builtin.meta: clear_facts # noqa unnamed-task
- ansible.builtin.meta: clear_facts # noqa name[missing]
6 changes: 3 additions & 3 deletions playbooks/exporter_postgres_start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# SPDX-License-Identifier: Apache-2.0

---
- name: postgres-exporter start
- name: Postgres exporter start
hosts: exporter_postgres
tasks:
- tosit.tdp.resolve: # noqa unnamed-task
- tosit.tdp.resolve: # noqa name[missing]
node_name: exporter_postgres
- name: Start postgres exporter
ansible.builtin.import_role:
name: tosit.tdp_observability.exporter.postgres
tasks_from: start
- ansible.builtin.meta: clear_facts # noqa unnamed-task
- ansible.builtin.meta: clear_facts # noqa name[missing]
8 changes: 4 additions & 4 deletions playbooks/exporter_postgres_status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# SPDX-License-Identifier: Apache-2.0

---
- name: postgres-exporter status
- name: Postgres exporter status
hosts: exporter_postgres
tasks:
- tosit.tdp.resolve: # noqa unnamed-task
- tosit.tdp.resolve: # noqa name[missing]
node_name: exporter_postgres
- name: postgres exporter status
- name: Postgres exporter status
ansible.builtin.import_role:
name: tosit.tdp_observability.exporter.postgres
tasks_from: status
- ansible.builtin.meta: clear_facts # noqa unnamed-task
- ansible.builtin.meta: clear_facts # noqa name[missing]
6 changes: 3 additions & 3 deletions playbooks/exporter_postgres_stop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# SPDX-License-Identifier: Apache-2.0

---
- name: postgres-exporter stop
- name: Postgres exporter stop
hosts: exporter_postgres
tasks:
- tosit.tdp.resolve: # noqa unnamed-task
- tosit.tdp.resolve: # noqa name[missing]
node_name: exporter_postgres
- name: Stop postgres exporter
ansible.builtin.import_role:
name: tosit.tdp_observability.exporter.postgres
tasks_from: stop
- ansible.builtin.meta: clear_facts # noqa unnamed-task
- ansible.builtin.meta: clear_facts # noqa name[missing]
7 changes: 4 additions & 3 deletions playbooks/loki_server_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
- name: Loki server config
hosts: loki
tasks:
- tosit.tdp.resolve:
- tosit.tdp.resolve: # noqa name[missing]
node_name: loki_server
- ansible.builtin.import_role:
- name: Configure loki server
ansible.builtin.import_role:
name: tosit.tdp_observability.loki.server
tasks_from: config
- ansible.builtin.meta: clear_facts
- ansible.builtin.meta: clear_facts # noqa name[missing]
7 changes: 4 additions & 3 deletions playbooks/loki_server_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
- name: Loki server install
hosts: loki
tasks:
- tosit.tdp.resolve:
- tosit.tdp.resolve: # noqa name[missing]
node_name: loki_server
- ansible.builtin.import_role:
- name: Install loki server
ansible.builtin.import_role:
name: tosit.tdp_observability.loki.server
tasks_from: install
- ansible.builtin.meta: clear_facts
- ansible.builtin.meta: clear_facts # noqa name[missing]
7 changes: 4 additions & 3 deletions playbooks/loki_server_restart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
- name: Loki server restart
hosts: loki
tasks:
- tosit.tdp.resolve:
- tosit.tdp.resolve: # noqa name[missing]
node_name: loki_server
- ansible.builtin.import_role:
- name: Restart loki server
ansible.builtin.import_role:
name: tosit.tdp_observability.loki.server
tasks_from: restart
- ansible.builtin.meta: clear_facts
- ansible.builtin.meta: clear_facts # noqa name[missing]
7 changes: 4 additions & 3 deletions playbooks/loki_server_start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
- name: Loki server start
hosts: loki
tasks:
- tosit.tdp.resolve:
- tosit.tdp.resolve: # noqa name[missing]
node_name: loki_server
- ansible.builtin.import_role:
- name: Start loki server
ansible.builtin.import_role:
name: tosit.tdp_observability.loki.server
tasks_from: start
- ansible.builtin.meta: clear_facts
- ansible.builtin.meta: clear_facts # noqa name[missing]
7 changes: 4 additions & 3 deletions playbooks/loki_server_stop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
- name: Loki server stop
hosts: loki
tasks:
- tosit.tdp.resolve:
- tosit.tdp.resolve: # noqa name[missing]
node_name: loki_server
- ansible.builtin.import_role:
- name: Stop loki server
ansible.builtin.import_role:
name: tosit.tdp_observability.loki.server
tasks_from: stop
- ansible.builtin.meta: clear_facts
- ansible.builtin.meta: clear_facts # noqa name[missing]
5 changes: 3 additions & 2 deletions roles/exporter/node/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

---
- name: systemctl daemon-reload
- name: Run systemctl daemon-reload
ansible.builtin.systemd:
daemon_reload: yes
daemon_reload: true
listen: systemctl daemon-reload
Loading
Loading