From 83345289be7714ba13bef4fd850376d81370295c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?c=C4=83t=C4=83lin?= Date: Mon, 12 Feb 2024 17:31:17 +0100 Subject: [PATCH] chore: add pre-commit config --- .gitignore | 2 +- .pre-commit-config.yaml | 17 +++++++++++++++++ ansible/ansible.cfg | 2 +- ansible/k3s/playbooks/base.yml | 2 +- ansible/k3s/playbooks/k3s.yml | 2 +- ansible/k3s/roles/base/tasks/main.yml | 4 ++-- ansible/k3s/roles/base/tasks/packages.yml | 2 +- ansible/k3s/roles/k3s/tasks/agent.yml | 2 +- ansible/k3s/roles/k3s/tasks/download.yml | 1 - ansible/k3s/roles/k3s/tasks/master.yml | 2 +- .../roles/k3s/templates/agent.config.yaml.j2 | 2 +- ansible/k3s/roles/k3s/vars/main.yml | 2 +- ansible/k3s/sample.env | 2 +- ansible/nextcloud/role-promtail.yml | 2 +- ansible/nextcloud/sample.env | 2 +- ansible/requirements.yml | 2 +- k8s/argo-apps/loki.yaml | 2 +- k8s/argo-apps/miniflux.yaml | 2 +- k8s/services/argo/project-fuku.yaml | 2 +- k8s/services/authentik/pvc.yaml | 2 +- k8s/services/authentik/sealedsecrets.yaml | 1 - k8s/services/dcsi/sealedsecrets.yaml | 1 - k8s/services/factorio/sealedsecrets.yaml | 1 - k8s/services/loki/traefik-auth-middleware.yaml | 2 +- k8s/services/miniflux/sealedsecrets.yaml | 1 - tofu/modules/proxmox-vm/variables.tf | 2 +- tofu/modules/truenas-vm/main.tf | 2 +- tofu/proxmox/sample.env | 2 +- 28 files changed, 40 insertions(+), 28 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.gitignore b/.gitignore index 36032ee..0166b40 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,4 @@ terraform.rc *.retry .idea/ secrets.yaml -.env \ No newline at end of file +.env diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..feabf83 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,17 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.2.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-added-large-files + - id: check-executables-have-shebangs + - id: check-json + - id: pretty-format-json + - id: check-merge-conflict + - id: check-symlinks + - id: check-yaml + args: + - --allow-multiple-documents + - id: detect-private-key + - id: trailing-whitespace diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg index 0626e63..dcb0621 100644 --- a/ansible/ansible.cfg +++ b/ansible/ansible.cfg @@ -1,3 +1,3 @@ [defaults] inventory = inventory -host_key_checking = False \ No newline at end of file +host_key_checking = False diff --git a/ansible/k3s/playbooks/base.yml b/ansible/k3s/playbooks/base.yml index 436bb6a..36c4e25 100644 --- a/ansible/k3s/playbooks/base.yml +++ b/ansible/k3s/playbooks/base.yml @@ -3,4 +3,4 @@ roles: - role: ../roles/base - become: yes \ No newline at end of file + become: yes diff --git a/ansible/k3s/playbooks/k3s.yml b/ansible/k3s/playbooks/k3s.yml index 0556511..1657a22 100644 --- a/ansible/k3s/playbooks/k3s.yml +++ b/ansible/k3s/playbooks/k3s.yml @@ -9,4 +9,4 @@ vars: first_master_hostname: "{{ groups['k3s_masters'][0] }}" is_first_master: "{{ inventory_hostname in groups['k3s_masters'][0] }}" - short_hostname: "{{ inventory_hostname.split('.')[0] }}" \ No newline at end of file + short_hostname: "{{ inventory_hostname.split('.')[0] }}" diff --git a/ansible/k3s/roles/base/tasks/main.yml b/ansible/k3s/roles/base/tasks/main.yml index b948de4..cbfd471 100644 --- a/ansible/k3s/roles/base/tasks/main.yml +++ b/ansible/k3s/roles/base/tasks/main.yml @@ -3,7 +3,7 @@ community.general.timezone: name: "{{ system_timezone }}" when: (system_timezone is defined) and (system_timezone != "Your/Timezone") - + - name: Enable IPv4 forwarding ansible.posix.sysctl: name: net.ipv4.ip_forward @@ -33,4 +33,4 @@ - import_tasks: mounts.yml name: Mount NFS shares tags: - - nfs \ No newline at end of file + - nfs diff --git a/ansible/k3s/roles/base/tasks/packages.yml b/ansible/k3s/roles/base/tasks/packages.yml index 70e9a54..a632312 100644 --- a/ansible/k3s/roles/base/tasks/packages.yml +++ b/ansible/k3s/roles/base/tasks/packages.yml @@ -14,4 +14,4 @@ - name: Update all packages apt: upgrade: dist - update_cache: yes \ No newline at end of file + update_cache: yes diff --git a/ansible/k3s/roles/k3s/tasks/agent.yml b/ansible/k3s/roles/k3s/tasks/agent.yml index 6e07591..286d46b 100644 --- a/ansible/k3s/roles/k3s/tasks/agent.yml +++ b/ansible/k3s/roles/k3s/tasks/agent.yml @@ -14,4 +14,4 @@ mode: 600 - name: Install k3s agent - shell: "bash /tmp/k3s.install.sh agent" \ No newline at end of file + shell: "bash /tmp/k3s.install.sh agent" diff --git a/ansible/k3s/roles/k3s/tasks/download.yml b/ansible/k3s/roles/k3s/tasks/download.yml index 81801d7..031d555 100644 --- a/ansible/k3s/roles/k3s/tasks/download.yml +++ b/ansible/k3s/roles/k3s/tasks/download.yml @@ -4,4 +4,3 @@ get_url: url: https://get.k3s.io dest: /tmp/k3s.install.sh - diff --git a/ansible/k3s/roles/k3s/tasks/master.yml b/ansible/k3s/roles/k3s/tasks/master.yml index f64fdec..1123b60 100644 --- a/ansible/k3s/roles/k3s/tasks/master.yml +++ b/ansible/k3s/roles/k3s/tasks/master.yml @@ -16,4 +16,4 @@ etcd_snapshot_dir: "/nfs/nas1/backups/{{ short_hostname }}" - name: Install k3s master - command: bash /tmp/k3s.install.sh \ No newline at end of file + command: bash /tmp/k3s.install.sh diff --git a/ansible/k3s/roles/k3s/templates/agent.config.yaml.j2 b/ansible/k3s/roles/k3s/templates/agent.config.yaml.j2 index b0f7313..0600ebc 100644 --- a/ansible/k3s/roles/k3s/templates/agent.config.yaml.j2 +++ b/ansible/k3s/roles/k3s/templates/agent.config.yaml.j2 @@ -1,2 +1,2 @@ token: {{ cluster_token }} -server: https://{{ tls_san }}:6443 \ No newline at end of file +server: https://{{ tls_san }}:6443 diff --git a/ansible/k3s/roles/k3s/vars/main.yml b/ansible/k3s/roles/k3s/vars/main.yml index cb5396e..cbf5790 100644 --- a/ansible/k3s/roles/k3s/vars/main.yml +++ b/ansible/k3s/roles/k3s/vars/main.yml @@ -1,4 +1,4 @@ --- k3s_version: "v1.27.4+k3s1" tls_san: "{{ lookup('env', 'ANSIBLE_TLS_SAN') | mandatory }}" -cluster_token: "{{ lookup('env', 'ANSIBLE_CLUSTER_TOKEN') | mandatory }}" \ No newline at end of file +cluster_token: "{{ lookup('env', 'ANSIBLE_CLUSTER_TOKEN') | mandatory }}" diff --git a/ansible/k3s/sample.env b/ansible/k3s/sample.env index ac7bdf4..14409ea 100644 --- a/ansible/k3s/sample.env +++ b/ansible/k3s/sample.env @@ -1,2 +1,2 @@ ANSIBLE_K3S_CLUSTER_TOKEN= -ANSIBLE_K3S_TLS_SAN= \ No newline at end of file +ANSIBLE_K3S_TLS_SAN= diff --git a/ansible/nextcloud/role-promtail.yml b/ansible/nextcloud/role-promtail.yml index 77c506c..68dfb3c 100644 --- a/ansible/nextcloud/role-promtail.yml +++ b/ansible/nextcloud/role-promtail.yml @@ -23,4 +23,4 @@ __path__: /mnt/share/data/cloud/data/{nextcloud,audit}.log promtail_config_limits_config: readline_rate_enabled: true - readline_rate_drop: true \ No newline at end of file + readline_rate_drop: true diff --git a/ansible/nextcloud/sample.env b/ansible/nextcloud/sample.env index 90a820a..7ea2c1c 100644 --- a/ansible/nextcloud/sample.env +++ b/ansible/nextcloud/sample.env @@ -1 +1 @@ -NEXTCLOUD_PROMTAIL_PASSWORD=superdupersecure \ No newline at end of file +NEXTCLOUD_PROMTAIL_PASSWORD=superdupersecure diff --git a/ansible/requirements.yml b/ansible/requirements.yml index a56717c..1254a53 100644 --- a/ansible/requirements.yml +++ b/ansible/requirements.yml @@ -1,2 +1,2 @@ - name: patrickjahns.promtail - version: 1.26.0 \ No newline at end of file + version: 1.26.0 diff --git a/k8s/argo-apps/loki.yaml b/k8s/argo-apps/loki.yaml index 825f876..b7e07d7 100644 --- a/k8s/argo-apps/loki.yaml +++ b/k8s/argo-apps/loki.yaml @@ -64,4 +64,4 @@ spec: persistence: enabled: true storageClass: default - size: 25Gi \ No newline at end of file + size: 25Gi diff --git a/k8s/argo-apps/miniflux.yaml b/k8s/argo-apps/miniflux.yaml index cd65265..4d15a73 100644 --- a/k8s/argo-apps/miniflux.yaml +++ b/k8s/argo-apps/miniflux.yaml @@ -15,4 +15,4 @@ spec: sources: [] project: roboces syncPolicy: - automated: {} \ No newline at end of file + automated: {} diff --git a/k8s/services/argo/project-fuku.yaml b/k8s/services/argo/project-fuku.yaml index 4361bc8..0e6f742 100644 --- a/k8s/services/argo/project-fuku.yaml +++ b/k8s/services/argo/project-fuku.yaml @@ -18,4 +18,4 @@ spec: - https://git.roboces.dev/catalin/fukuops.git - https://charts.goauthentik.io/ - https://kubereboot.github.io/charts - - https://sqljames.github.io/factorio-server-charts/ \ No newline at end of file + - https://sqljames.github.io/factorio-server-charts/ diff --git a/k8s/services/authentik/pvc.yaml b/k8s/services/authentik/pvc.yaml index 5516597..b3c1ca1 100644 --- a/k8s/services/authentik/pvc.yaml +++ b/k8s/services/authentik/pvc.yaml @@ -9,4 +9,4 @@ spec: storageClassName: "truenas-nfs-csi" resources: requests: - storage: 3Gi \ No newline at end of file + storage: 3Gi diff --git a/k8s/services/authentik/sealedsecrets.yaml b/k8s/services/authentik/sealedsecrets.yaml index 52b5f90..36744bb 100644 --- a/k8s/services/authentik/sealedsecrets.yaml +++ b/k8s/services/authentik/sealedsecrets.yaml @@ -17,4 +17,3 @@ spec: name: secrets-authentik namespace: apps-fuku type: Opaque - diff --git a/k8s/services/dcsi/sealedsecrets.yaml b/k8s/services/dcsi/sealedsecrets.yaml index 02c501e..ec5e989 100644 --- a/k8s/services/dcsi/sealedsecrets.yaml +++ b/k8s/services/dcsi/sealedsecrets.yaml @@ -13,4 +13,3 @@ spec: name: secrets-dcsi namespace: democratic-csi type: Opaque - diff --git a/k8s/services/factorio/sealedsecrets.yaml b/k8s/services/factorio/sealedsecrets.yaml index 8e1b5a8..35d603f 100644 --- a/k8s/services/factorio/sealedsecrets.yaml +++ b/k8s/services/factorio/sealedsecrets.yaml @@ -15,4 +15,3 @@ spec: name: secrets-factorio namespace: apps-fuku type: Opaque - diff --git a/k8s/services/loki/traefik-auth-middleware.yaml b/k8s/services/loki/traefik-auth-middleware.yaml index b67c40f..20e80fa 100644 --- a/k8s/services/loki/traefik-auth-middleware.yaml +++ b/k8s/services/loki/traefik-auth-middleware.yaml @@ -5,4 +5,4 @@ metadata: namespace: monitoring spec: basicAuth: - secret: loki-auth-secret \ No newline at end of file + secret: loki-auth-secret diff --git a/k8s/services/miniflux/sealedsecrets.yaml b/k8s/services/miniflux/sealedsecrets.yaml index 6329aec..be9a5fa 100644 --- a/k8s/services/miniflux/sealedsecrets.yaml +++ b/k8s/services/miniflux/sealedsecrets.yaml @@ -16,4 +16,3 @@ spec: creationTimestamp: null name: miniflux namespace: apps-roboces - diff --git a/tofu/modules/proxmox-vm/variables.tf b/tofu/modules/proxmox-vm/variables.tf index 313b7fa..8b926c0 100644 --- a/tofu/modules/proxmox-vm/variables.tf +++ b/tofu/modules/proxmox-vm/variables.tf @@ -63,4 +63,4 @@ variable "disk_storage_name" { description = "Disk storage name" type = string default = "storage" -} \ No newline at end of file +} diff --git a/tofu/modules/truenas-vm/main.tf b/tofu/modules/truenas-vm/main.tf index 4a9805f..2dd3310 100644 --- a/tofu/modules/truenas-vm/main.tf +++ b/tofu/modules/truenas-vm/main.tf @@ -5,4 +5,4 @@ terraform { version = "0.11.1" } } -} \ No newline at end of file +} diff --git a/tofu/proxmox/sample.env b/tofu/proxmox/sample.env index bc4ed69..d50d1f9 100644 --- a/tofu/proxmox/sample.env +++ b/tofu/proxmox/sample.env @@ -1,4 +1,4 @@ PM_USER= PM_PASS= PM_API_URL= -TF_VAR_ci_password= \ No newline at end of file +TF_VAR_ci_password=