diff --git a/.taskfiles/Ansible/Taskfile.yaml b/.taskfiles/Ansible/Taskfile.yaml index 0e24c969..399181a4 100644 --- a/.taskfiles/Ansible/Taskfile.yaml +++ b/.taskfiles/Ansible/Taskfile.yaml @@ -34,8 +34,9 @@ tasks: prompt: Run Ansible playbook '{{.playbook}}'... continue? deps: ["deps"] cmd: .venv/bin/ansible-playbook --inventory {{.ANSIBLE_INVENTORY_FILE}} {{.ANSIBLE_DIR}}/playbooks/{{.playbook}}.yaml {{.CLI_ARGS}} + requires: + vars: ["playbook"] preconditions: - - { msg: "Missing playbook arg", sh: "test -n {{.playbook}}" } - { msg: "Missing Ansible inventory file", sh: "test -f {{.ANSIBLE_INVENTORY_FILE}}" } poweroff: diff --git a/.taskfiles/Flux/Taskfile.yaml b/.taskfiles/Flux/Taskfile.yaml index d2267970..c309334e 100644 --- a/.taskfiles/Flux/Taskfile.yaml +++ b/.taskfiles/Flux/Taskfile.yaml @@ -46,9 +46,9 @@ tasks: | \ kubectl apply --kubeconfig {{.KUBECONFIG_FILE}} --server-side \ --field-manager=kustomize-controller -f - + requires: + vars: ["path", "ns"] vars: - path: '{{ or .path (fail "Argument (path) is required") }}' - ns: '{{.ns | default "flux-system"}}' ks: sh: flux --kubeconfig {{.KUBECONFIG_FILE}} --namespace {{.ns}} get kustomizations $(basename {{.path}}) 2>&1 preconditions: diff --git a/.taskfiles/Sops/Taskfile.yaml b/.taskfiles/Sops/Taskfile.yaml index c9291299..84dc4b2e 100644 --- a/.taskfiles/Sops/Taskfile.yaml +++ b/.taskfiles/Sops/Taskfile.yaml @@ -27,6 +27,8 @@ tasks: .encrypt-file: internal: true cmd: sops --encrypt --in-place {{.file}} + requires: + vars: ["file"] preconditions: - { msg: "Missing Sops config file", sh: "test -f {{.SOPS_CONFIG_FILE}}" } - { msg: "Missing Sops Age key file", sh: "test -f {{.SOPS_AGE_FILE}}" } diff --git a/.taskfiles/Talos/Taskfile.yaml b/.taskfiles/Talos/Taskfile.yaml index d17c7f34..6c307e9a 100644 --- a/.taskfiles/Talos/Taskfile.yaml +++ b/.taskfiles/Talos/Taskfile.yaml @@ -56,17 +56,15 @@ tasks: upgrade-talos: desc: Upgrade talos on a node cmd: talosctl --nodes {{.node}} upgrade --image {{.image}} --preserve=true --reboot-mode=powercycle - vars: - image: '{{ or .image (fail "Argument (image) is required") }}' - node: '{{ or .node (fail "Argument (node) is required") }}' + requires: + vars: ["node", "to"] preconditions: - { msg: "Node not found", sh: "talosctl --nodes {{.node}} get machineconfig" } upgrade-k8s: desc: Upgrade k8s on a node cmd: talosctl --nodes {{.node}} upgrade-k8s --to {{.to}} - vars: - node: '{{ or .node (fail "Argument (node) is required") }}' - to: '{{ or .to (fail "Argument (to) is required") }}' + requires: + vars: ["node", "to"] preconditions: - { msg: "Node not found", sh: "talosctl --nodes {{.node}} get machineconfig" }