diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 27483df79..15020ad11 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -21,6 +21,7 @@ runtimes: # This is the section where you manage your linters. (https://docs.trunk.io/check/configuration) lint: enabled: + - ansible-lint@24.10.0 - actionlint@1.7.1 - bandit@1.7.9 - black@24.4.2 @@ -38,17 +39,18 @@ lint: - shfmt@3.6.0 - taplo@0.9.2 - trivy@0.53.0 - - trufflehog@3.80.1 - yamllint@1.35.1 disabled: # Disabled explicitly because I think these break the integration with Trunk and VSCode - hadolint + - trufflehog actions: enabled: - - trunk-announce - trunk-check-pre-push - trunk-fmt-pre-commit - trunk-upgrade-available + disabled: + - trunk-announce tools: disabled: - poetry @@ -64,6 +66,7 @@ tools: - pdm@2.17.1 - gum@0.14.3 - devspace@6.3.14 + - ansible@10.6.0 definitions: - name: bazelisk download: bazelisk @@ -100,6 +103,11 @@ tools: shims: - name: devspace target: devspace + - name: ansible + runtime: python + package: ansible + shims: [ansible, ansible-playbook, ansible-galaxy] + known_good_version: 10.6.0 downloads: - name: bazelisk diff --git a/.vscode/settings.json b/.vscode/settings.json index ddf11aec4..14845ff9a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -20,5 +20,6 @@ "files.exclude": { "**/bazel-*": true, "haos/custom_components/hacs/**/*": true - } + }, + "trunk.autoInit": false } diff --git a/ansible/filter_plugins/not_falsy.py b/ansible/filter_plugins/not_falsy.py deleted file mode 100644 index 77ffa0adc..000000000 --- a/ansible/filter_plugins/not_falsy.py +++ /dev/null @@ -1,10 +0,0 @@ -# Copied from https://github.com/ansible/ansible/issues/17329#issuecomment-731281767 -class FilterModule(object): - def filters(self): - return {"not_falsy": self.not_falsy} - - def not_falsy(self, input): - if not input: - raise Exception('"Falsy" values not allowed.') - - return input diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml new file mode 100644 index 000000000..e69de29bb diff --git a/ansible/group_vars/provisioner.yml b/ansible/group_vars/provisioner.yml new file mode 100644 index 000000000..40bff6024 --- /dev/null +++ b/ansible/group_vars/provisioner.yml @@ -0,0 +1,4 @@ +ansible_python_interpreter: /usr/bin/python +ansible_user: root +ansible_become: false +ansible_remote_tmp: /tmp/ diff --git a/ansible/production b/ansible/production new file mode 100644 index 000000000..a1075cf46 --- /dev/null +++ b/ansible/production @@ -0,0 +1,2 @@ +[provisioner] +provisioner \ No newline at end of file diff --git a/ansible/provisioner.yml b/ansible/provisioner.yml new file mode 100644 index 000000000..e83629b27 --- /dev/null +++ b/ansible/provisioner.yml @@ -0,0 +1,4 @@ +--- +- hosts: provisioner + roles: + - pikvm diff --git a/ansible/roles/pikvm/tasks/main.yml b/ansible/roles/pikvm/tasks/main.yml new file mode 100644 index 000000000..5ba7518c2 --- /dev/null +++ b/ansible/roles/pikvm/tasks/main.yml @@ -0,0 +1,28 @@ +- name: Update PiKVM + block: + - name: Remount read-write to prepare for changes + ansible.builtin.command: rw + changed_when: false + when: not ansible_check_mode + + - name: Generate PiKVM config + ansible.builtin.template: + src: meta.yml.j2 + dest: /etc/kvmd/meta.yaml + group: root + owner: root + mode: "0644" + vars: + pikvm_hostname: "{{ ansible_hostname }}" + + rescue: + - name: Something went wrong + ansible.builtin.debug: + msg: An error occured + when: not ansible_check_mode + + always: + - name: Remount read-only + ansible.builtin.command: ro + changed_when: false + when: not ansible_check_mode diff --git a/ansible/roles/pikvm/templates/meta.yml.j2 b/ansible/roles/pikvm/templates/meta.yml.j2 new file mode 100644 index 000000000..0bdefa632 --- /dev/null +++ b/ansible/roles/pikvm/templates/meta.yml.j2 @@ -0,0 +1,9 @@ +# You can write down any information and it will be available +# at the address /api/info (if you use default nginx config). +# If server.host (str) will be defined then this value +# will be displayed in the web interface. + +server: + host: {{ pikvm_hostname }} + +kvm: {} \ No newline at end of file diff --git a/ansible/site.yml b/ansible/site.yml new file mode 100644 index 000000000..58fe25ebf --- /dev/null +++ b/ansible/site.yml @@ -0,0 +1,2 @@ +--- +- import_playbook: provisioner.yml diff --git a/devenv/deploys/editor/files/settings.json b/devenv/deploys/editor/files/settings.json index 4014b6171..472167ed7 100755 --- a/devenv/deploys/editor/files/settings.json +++ b/devenv/deploys/editor/files/settings.json @@ -94,5 +94,6 @@ "**/.trunk/*out/": true, "**/.trunk/*plugins/": true }, - "editor.defaultFormatter": "trunk.io" + "editor.defaultFormatter": "trunk.io", + "trunk.autoInit": false }