From b92f2c6175592e89e6c6bbb43520d393b81b4e4c Mon Sep 17 00:00:00 2001 From: Simon Cornet Date: Mon, 16 Feb 2026 17:51:23 +0100 Subject: [PATCH] ci: add various configs and linter fixes --- .markdownlint-cli2.jsonc | 12 ++++++++++++ handlers/main.yaml | 3 ++- playbook.yaml | 2 +- roles/{requirements.yaml => requirements.yml} | 0 tasks/routing.yaml | 7 +++---- 5 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 .markdownlint-cli2.jsonc rename roles/{requirements.yaml => requirements.yml} (100%) diff --git a/.markdownlint-cli2.jsonc b/.markdownlint-cli2.jsonc new file mode 100644 index 0000000..56cd87c --- /dev/null +++ b/.markdownlint-cli2.jsonc @@ -0,0 +1,12 @@ +{ + // files to lint + "globs": [ + "readme.md" + ], + // linting rules + "config": { + "MD013": { + "line_length": 120 + } + } +} diff --git a/handlers/main.yaml b/handlers/main.yaml index bc8bff4..90a6954 100644 --- a/handlers/main.yaml +++ b/handlers/main.yaml @@ -11,7 +11,8 @@ ansible.builtin.shell: cmd: | {% for route in static_routes %} - ip route replace {{ route.destination }} via {{ route.gateway }}{{ ' dev ' + route.interface if route.interface is defined else '' }} + ip route replace {{ route.destination }} via {{ route.gateway }} + {% if route.interface is defined %}dev {{ route.interface }}{% endif %} {% endfor %} when: "static_routes | length > 0" changed_when: false diff --git a/playbook.yaml b/playbook.yaml index 9778b5a..02f9af9 100644 --- a/playbook.yaml +++ b/playbook.yaml @@ -10,7 +10,7 @@ # due to semaphore bug we need to do this ourselves - name: "force-update requirements" ansible.builtin.command: - cmd: "ansible-galaxy install -f -r roles/requirements.yaml" + cmd: "ansible-galaxy install -f -r roles/requirements.yml" become: false delegate_to: "localhost" changed_when: false diff --git a/roles/requirements.yaml b/roles/requirements.yml similarity index 100% rename from roles/requirements.yaml rename to roles/requirements.yml diff --git a/tasks/routing.yaml b/tasks/routing.yaml index 390c45c..33f75b2 100644 --- a/tasks/routing.yaml +++ b/tasks/routing.yaml @@ -43,14 +43,13 @@ block: | {% for route in static_routes %} # {{ route.name }} - {% if route.metric is defined %} + {% if route.metric is defined %} down ip route del {{ route.destination }} via {{ route.gateway }}{{ ' dev ' + route.interface if route.interface is defined else '' }} metric {{ route.metric }} up ip route add {{ route.destination }} via {{ route.gateway }}{{ ' dev ' + route.interface if route.interface is defined else '' }} metric {{ route.metric }} - {% else %} + {% else %} down ip route del {{ route.destination }} via {{ route.gateway }}{{ ' dev ' + route.interface if route.interface is defined else '' }} up ip route add {{ route.destination }} via {{ route.gateway }}{{ ' dev ' + route.interface if route.interface is defined else '' }} - - {% endif %} + {% endif %} {% endfor %} insertafter: "^iface {{ lan_interface }} inet.*\\n(\\s+.*\\n)*\\s+netmask" state: "{{ 'present' if static_routes | length > 0 else 'absent' }}"